Add -h, --version, and --help options.
This commit is contained in:
		| @@ -35,7 +35,7 @@ when isMainModule: | ||||
|   var outFile: File | ||||
|  | ||||
|   try: | ||||
|     let VERSION = "0.1.0" | ||||
|     let VERSION = "0.2.0" | ||||
|     let usage = """ | ||||
| Usage: | ||||
|   log_happy [options] | ||||
| @@ -44,7 +44,8 @@ Usage: | ||||
|  | ||||
| Options: | ||||
|  | ||||
|   -v                        Print version information and exit. | ||||
|   -h --help                 Print this usage information and exit. | ||||
|   -v --version              Print version information and exit. | ||||
|   -e<label>;<pattern>       Add something to expect to see in the log stream. | ||||
|   -E<label>;<patterh>       Add something to expect not to see in the log stream. | ||||
|   -d<def-file>              Read expectations from a JSON definitions file. | ||||
| @@ -136,10 +137,14 @@ Expectations JSON definitions follow this format: | ||||
|           expected: m[0] == "e", | ||||
|           found: false)) | ||||
|  | ||||
|       elif arg == "-v": | ||||
|       elif arg == "-v" or arg == "--version": | ||||
|         stdout.writeLine "log_happy v" & VERSION | ||||
|         quit(QuitSuccess) | ||||
|  | ||||
|       elif arg == "-h" or arg == "--help": | ||||
|         stdout.writeLine usage | ||||
|         quit(QuitSuccess) | ||||
|  | ||||
|       elif arg == "-f": follow = true | ||||
|       elif arg == "--": cmd = "" | ||||
|       else: exitErr "unrecognized argument: " & arg | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| # Package | ||||
|  | ||||
| version       = "0.1.0" | ||||
| version       = "0.2.0" | ||||
| author        = "Jonathan Bernard" | ||||
| description   = "Scan logs for regex-defined events and report on what was found." | ||||
| license       = "MIT" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user