Added help and exit
This commit is contained in:
@@ -4,15 +4,17 @@ from scripts.say_greeting import say_greeting
|
||||
from scripts.make_file import make_file
|
||||
from scripts.touch_file import touch_file
|
||||
from scripts.remove import remove
|
||||
from scripts.help import help
|
||||
from scripts.exit import exit
|
||||
from pathlib import Path
|
||||
|
||||
# Shitty test
|
||||
# list_files.main()
|
||||
|
||||
verbose = 1
|
||||
if_verbose = 0
|
||||
|
||||
def verbose(strings):
|
||||
if verbose == 1:
|
||||
if if_verbose == 1:
|
||||
print(str(strings))
|
||||
|
||||
|
||||
@@ -21,6 +23,7 @@ def get_config_line(keyword):
|
||||
# Adjust the number of .parent calls based on where this function lives!
|
||||
# If this is in main.py, it's just Path(__file__).parent
|
||||
base_dir = Path(__file__).resolve().parent
|
||||
verbose(f"base_dir: {base_dir}")
|
||||
config_file = base_dir / "config" / "pointerfile.txt"
|
||||
|
||||
if not config_file.exists():
|
||||
@@ -47,12 +50,17 @@ def match_command(command, args_list):
|
||||
make_file.main(args_list)
|
||||
elif command == "remove":
|
||||
remove.main(args_list)
|
||||
elif command == "help":
|
||||
help.main(args_list)
|
||||
elif command == "exit":
|
||||
exit.main(args_list)
|
||||
# use if else if else if else if to match the output
|
||||
|
||||
def cmdrun(keyword):
|
||||
parsed = keyword.split()
|
||||
verbose(parsed)
|
||||
get_config_result = get_config_line(parsed[0])
|
||||
print(get_config_result)
|
||||
verbose(get_config_result)
|
||||
if not get_config_result == None:
|
||||
match_command(get_config_result[1], parsed[1:])
|
||||
return True
|
||||
@@ -62,6 +70,7 @@ def cmdrun(keyword):
|
||||
if __name__ == "__main__":
|
||||
print("BUGPy-mOS 0 \"Devvie\"")
|
||||
while True:
|
||||
inputs = input("BUGS > ")
|
||||
if not cmdrun(inputs):
|
||||
print("BAD COMMAND")
|
||||
inputs = input("\nBUGS > ")
|
||||
if not inputs.strip() == "":
|
||||
if not cmdrun(inputs):
|
||||
print("BAD COMMAND")
|
||||
|
||||
Reference in New Issue
Block a user