-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
39 lines (28 loc) · 948 Bytes
/
Copy pathtasks.py
File metadata and controls
39 lines (28 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import sys
from invoke import Context, task
_ROOT = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(_ROOT, 'src'))
from application import Application # noqa: E402
@task
def run_json_data_sorter(c: Context) -> None:
"""Run JSON Data Sorter"""
print('Provide the directory name you put the JSON file in')
dirname = input().strip()
print('Provide the filename of which JSON data name you would like '
'to sort')
filename = input().strip()
print('Provide asc(default) or desc you would like to sort '
'key-value in')
order = input().strip()
params: dict[str, str] = {}
for key, value in {
'dirname': dirname, 'filename': filename, 'order': order,
}.items():
if value:
params[key] = value
Application.run(**params)
@task(default=True)
def test(c: Context) -> None:
"""Run all tests"""
c.run('pytest .')