Skip to content

Commit

Permalink
add in_place in readme + it's examples
Browse files Browse the repository at this point in the history
  • Loading branch information
AHReccese committed Aug 5, 2024
1 parent b519fb0 commit 57dbdfc
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,30 +62,33 @@ DMeta is an open source Python package that removes metadata of Microsoft Office

## Usage
### In Python
#### Clear metadata for a .docx file
⚠️ You can use the `in_place` flag in functions to indicate if the action should affect the original file(s).

⚠️`in_place` flag is `False` by default.

#### Clear metadata for a .docx file in place
```python
import os
from dmeta.functions import clear

DOCX_FILE_PATH = os.path.join(os.getcwd(), "sample.docx")
clear(DOCX_FILE_PATH)
clear(DOCX_FILE_PATH, in_place=True)
```
#### Clear metadata for all existing .docx files in the current directory
```python
from dmeta.functions import clear_all
clear_all()
```
#### Update metadata for a .docx file
#### Update metadata for a .docx file in place
```python
import os
from dmeta.functions import update

CONFIG_FILE_PATH = os.path.join(os.getcwd(), "config.json")
DOCX_FILE_PATH = os.path.join(os.getcwd(), "sample.docx")
update(CONFIG_FILE_PATH, DOCX_FILE_PATH)
update(CONFIG_FILE_PATH, DOCX_FILE_PATH, in_place=True)
```

### Update metadata for all existing .docx files in the current directory
#### Update metadata for all existing .docx files in the current directory
```python
import os
from dmeta.functions import update_all
Expand All @@ -96,24 +99,26 @@ update_all(CONFIG_FILE_PATH)

### CLI
⚠️ You can use `dmeta` or `python -m dmeta` to run this program
⚠️ You can use the `inplace` flag in CLI to indicate if the action should affect the original file(s).

#### Version
```console
dmeta -v
dmeta --version
```
### Clear metadata for a .docx file
#### Clear metadata for a .docx file in place
```console
dmeta --clear "./test_a.docx"
dmeta --clear "./test_a.docx" --inplace
```
### Clear metadata for all existing .docx files in the current directory
#### Clear metadata for all existing .docx files in the current directory
```console
dmeta --clear-all
```
### Update metadata for a .docx file
#### Update metadata for a .docx file in place
```console
dmeta --update "./test_a.docx" --config "./config.json"
dmeta --update "./test_a.docx" --config "./config.json" --inplace
```
### Update metadata for all existing .docx files in the current directory
#### Update metadata for all existing .docx files in the current directory
```console
dmeta --update-all --config "./config.json"
```
Expand Down

0 comments on commit 57dbdfc

Please sign in to comment.