rexx-things/projects/python/params.py

33 lines
791 B
Python
Executable File

#!/usr/bin/env python
import sys
import os
def parse_argv() -> tuple:
if len(sys.argv) == 1:
help()
sys.argv.pop(0) # remove the script name
instruction = sys.argv.pop(0) # capture the first arg
params = ' '.join(sys.argv).strip("(").strip(")") # render the remaining as a string
return instruction, params
def help() -> None:
os.system('clear')
print("********************************************************")
print("* YOUR STRINGS WERE EMPTY. HOW DARE YOU. *")
print("********************************************************")
exit(1)
def main():
instruction, params = parse_argv()
print(f"Instruction: {instruction}")
print(f"Parameter : {params}")
exit
if __name__ == "__main__":
main()