Compare commits
No commits in common. "1a0d3b37336143664ffcf1bb1707dc5a0a478a1a" and "e78b31e1a8b91251b987228cac558184c60ef973" have entirely different histories.
1a0d3b3733
...
e78b31e1a8
2 changed files with 4 additions and 28 deletions
12
README.md
12
README.md
|
@ -8,15 +8,7 @@ python3 edit_data_form.py
|
||||||
|
|
||||||
## Daten eines bestehenden Mitglieds ändern
|
## Daten eines bestehenden Mitglieds ändern
|
||||||
|
|
||||||
Eine Nennung des Ordners des Members genügt.
|
|
||||||
Dann wird stets die aktuelle json-Datei verwendet.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 edit_data_form.py <path/to/member/>
|
MEMBER_FILE=<path/to/member/json>
|
||||||
```
|
python3 edit_data_form.py $MEMBER_FILE
|
||||||
|
|
||||||
Alternativ kann die json-Datei explizit genannt werden:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 edit_data_form.py <path/to/member/member.json>
|
|
||||||
```
|
```
|
|
@ -1,7 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
import os
|
|
||||||
import npyscreen
|
import npyscreen
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -66,24 +65,9 @@ class FormApp(npyscreen.NPSAppManaged):
|
||||||
def main(*_args):
|
def main(*_args):
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
file_path = pathlib.Path(sys.argv[1])
|
file_path = pathlib.Path(sys.argv[1])
|
||||||
|
if not file_path.exists():
|
||||||
if(sys.argv[1].endswith(".json")):
|
print("Trying to open nonexistent file. Aborting.")
|
||||||
# json file as argument
|
|
||||||
|
|
||||||
if not file_path.exists():
|
|
||||||
print("Trying to open nonexistent file. Aborting.")
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
elif file_path.is_dir():
|
|
||||||
# we want the latest json file in given folder
|
|
||||||
filesList = [f for f in os.listdir(file_path) if os.path.isfile(os.path.join(file_path, f)) and f.endswith(".json")]
|
|
||||||
filesList.sort()
|
|
||||||
file_path = os.path.join(file_path, filesList[-1])
|
|
||||||
|
|
||||||
else:
|
|
||||||
print("Please enter a valid json file or the directory containing the json file!")
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
file_path = pathlib.Path(pathlib.Path(__file__).absolute().parent, 'example.json')
|
file_path = pathlib.Path(pathlib.Path(__file__).absolute().parent, 'example.json')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue