diff --git a/README.md b/README.md index 85ef08b..53c2c59 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,9 @@ The location to a source file must be supplied. #### From the command line ``` python gus.py example.html +python gus.py -f example.html or python gus.py --file example.html to check a file +python gus.py -v or python gus.py --version for version info +python gus.py -h or python gus.py --help for help ``` #### From the python shell ``` diff --git a/gus.py b/gus.py index cd9bf05..ff78380 100644 --- a/gus.py +++ b/gus.py @@ -88,10 +88,19 @@ def get_help(): help = open('help.txt').read() print(help) except: - print("error printing help") + print("error printing help") if __name__ == "__main__": - if (len(sys.argv)==1): - get_help() # calls for help if no arg provided + if len(sys.argv) == 1: + get_help() # calls for help if no arg provided + elif len(sys.argv) == 2 and str(sys.argv[1])[:1] != "-": + tavo(str(sys.argv[1])) # send command line arg to main function else: - tavo(str(sys.argv[1])) # send command line arg to main function \ No newline at end of file + if len(sys.argv) == 3 and (sys.argv[1] == "-f" or sys.argv[1] == "--file"): + tavo(str(sys.argv[2])) # send command line arg to main function + elif len(sys.argv) == 2 and (sys.argv[1] == "-v" or sys.argv[1] == "--version"): + print('Get-Url-Status (GUS) Text-As-Visual-Output (TAVO) version 0.1') # print version info + elif len(sys.argv) == 2 and (sys.argv[1] == "-h" or sys.argv[1] == "--help"): + get_help() + else: + print('invalid argument error') # print if user inputs wrong argument or if there are too many arguments diff --git a/help.txt b/help.txt index 3d6a6f5..66ad876 100644 --- a/help.txt +++ b/help.txt @@ -5,12 +5,23 @@ GUS can be used from the command line or python shell The location to a source file must be supplied. -From the command line: +To check files from the command line: >>> python gus.py example.txt or >>> python gus.py ~/another/file.html +or +>>> python gus.py -f or --file example.txt +or +>>> python gus.py -f or --file ~/another/file.html + +To check version information: +>>> python gus.py -v or --version + +To get help: +>>> python gus.py -h or --help + -From the python shell: +To check files from the python shell: >>> import gus >>> gus.tavo("your.filename.here")