Skip to content

Commit 1b43d40

Browse files
CLI Bug Fix (#188)
* fix : generate-config bug fixed * fix : EXIT_FLAG --> exit_flag * fix : minor edit in tests * fix : codacy issue fixed
1 parent 36a0ee7 commit 1b43d40

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- name: First test
4141
run: |
4242
nafas --version --color="red" --bg-color="blue" --intensity="bright"
43-
nafas --generate-config="test.json" --skip-intro
43+
nafas --generate-config="test.json"
4444
- name: Install dev-requirements
4545
run: |
4646
python otherfiles/requirements-splitter.py

nafas/__main__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ def run(args: argparse.Namespace) -> None:
5151
silent_flag = args.silent
5252
if args.version:
5353
print(NAFAS_VERSION)
54+
elif args.generate_config:
55+
result = generate_config(args.generate_config)
56+
if not result:
57+
print(CONFIG_GENERATE_ERROR_MESSAGE)
58+
else:
59+
print(CONFIG_GENERATE_SUCCESS_MESSAGE)
60+
sys.exit()
5461
else:
5562
clear_screen()
5663
if not args.skip_intro:
@@ -60,15 +67,8 @@ def run(args: argparse.Namespace) -> None:
6067
tprint("Silent Mode")
6168
print_nafas_description()
6269
_ = input("Press any key to continue.\n")
63-
EXIT_FLAG = False
64-
if args.generate_config:
65-
result = generate_config(args.generate_config)
66-
if not result:
67-
print(CONFIG_GENERATE_ERROR_MESSAGE)
68-
else:
69-
print(CONFIG_GENERATE_SUCCESS_MESSAGE)
70-
sys.exit()
71-
while not EXIT_FLAG:
70+
exit_flag = False
71+
while not exit_flag:
7272
if args.config:
7373
result = load_config(args.config)
7474
if result["status"]:
@@ -93,7 +93,7 @@ def run(args: argparse.Namespace) -> None:
9393
INPUTINDEX = str(
9494
input("Press [R] to restart or any other key to exit."))
9595
if INPUTINDEX.upper() != "R":
96-
EXIT_FLAG = True
96+
exit_flag = True
9797
print(EXIT_MESSAGE)
9898
else:
9999
clear_screen()

0 commit comments

Comments
 (0)