sysargv module¶
SysArgv class¶
- class tatogalib.util.sysargv.SysArgv¶
Class for parsing commandline arguments. All arguments must be an option string with or without a value, e.g.
myapp –cli –infilename myinfile –outfilename “my out file”
args = SysArgs() # creates the object and parses all arguments from sys.argv args.get("cli") # returns True args.get("infilename") # returns "myinfile" args.get("outfilename") # returns "my out file" args.get("whatever") # returns None
- get(option_name)¶
Get a commandline argument identified by its option name. Returns None if the option name does not exist.
- Parameters:
option_name (str) – The name of the option string
- Returns:
The value of the option string or None
- get_all()¶
Get all commandline arguments
- Returns:
The dictionary with the option names and their values
- length()¶
Gets the number of parsed arguments
- Returns:
number of arguments