sorcha.utilities.sorchaCommandLineParser
Functions
|
Given a path to a file(s), first determine if the file exists. If it does not |
|
Parses the command line arguments, error-handles them, then stores them in a single dict. |
Module Contents
- warn_or_remove_file(filepath, force_remove, pplogger)[source]
Given a path to a file(s), first determine if the file exists. If it does not exist, pass through.
If the file does exist check if the user has set --force on the command line. If the user set --force, log that the existing file will be removed. Otherwise, warn the user that the file exists and exit the program.
- Parameters:
filepath (string) -- The full file path to a given file. i.e. /home/data/output.csv
force_remove (boolean) -- Whether to remove the file if it exists.
pplogger (Logger) -- Used to log the output.
- sorchaCommandLineParser(args)[source]
Parses the command line arguments, error-handles them, then stores them in a single dict.
Will only look for the comet parameters file if it's actually given at the command line.
- Parameters:
args (ArgumentParser object) -- argparse object of command line arguments
- Returns:
cmd_args_dict -- dictionary of variables taken from command line arguments
- Return type:
dictionary