fastoad.cmd.cli_utils module

Utility functions for CLI interface.

fastoad.cmd.cli_utils.overwrite_option(func)[source]

Decorator for adding the option for overwriting existing file.

Use force as argument of the function.

fastoad.cmd.cli_utils.out_file_option(func)[source]

Decorator for writing command output in a file.

Use out_file and force as argument of the function.

fastoad.cmd.cli_utils.manage_overwrite(func: Callable, filename_func: Optional[Callable] = None, **kwargs)[source]

Runs func, that is expected to write a file, with provided keyword arguments args.

If the run throws FastPathExistsError, a question is displayed and user is asked for a yes/no answer. If yes is given, arg[“overwrite”] is set to True and func is run again.

Parameters
  • func – callable that will do the operation and is expected to return the path of written element.

  • filename_func – a function that provides the name of written file, given the value returned by func

  • kwargs – keyword arguments for func

Returns

True if the file has been written,