cli_utilities

Attributes

logger

Functions

warn_or_remove_file(filepath, force_remove, pplogger)

Given a path to a file(s), first determine if the file exists. If it does not

Module Contents

logger[source]
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.