scd.main
¶
Module, which has routines for scd CLI.
-
scd.main.
catch_exceptions
(func)¶ Decorator which makes function more CLI friendly.
If everything is ok, it returns
os.EX_OK
(code 0), if not -os.EX_SOFTWARE
(code 70). Also, it is smart enough to differ verbose and debug mode and print accordingly.
-
scd.main.
configure_logging
()¶ Configure logging based on
OPTIONS
.
-
scd.main.
get_options
()¶ Return parsed commandline arguments.
Returns: Parsed commandline arguments Return type: argparse.Namespace
-
scd.main.
guess_configfile
()¶ Return file-like object, guessing where the hell if config file.
Returns: Open config. Return type: file-like object Raises: ValueError – if cannot find config file.
-
scd.main.
main
()¶ Main function.
Basically, it parses CLI, creates config, traverse files and does modifications. All that scd does is happening with this function.
-
scd.main.
process_file
(fileobj, config)¶ Function, which is responsible for processing of file.
Parameters: - fileobj (
scd.files.File
) – File to process. - config (
scd.config.Config
) – Parsed configuration.
- fileobj (
-
scd.main.
search_config_in_directory
(directory)¶ Return config file name if it is found in directory.
Parameters: directory (str) – Path to the directory where to search config files. Returns: Path to the config file (absolute) or None
if nothing is foundReturn type: str or None