:mod:`khard.cli` ================ .. py:module:: khard.cli .. autoapi-nested-parse:: Command line parsing and configuration logic for khard Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: khard.cli.field_argument khard.cli.comma_separated_argument khard.cli.create_parsers khard.cli.parse_args khard.cli.merge_args_into_config khard.cli.init .. data:: logger .. function:: field_argument(orignal: str) -> List[str] Ensure the fields specified for `ls -F` are proper field names. Nested attribute names are not checked. :param orignal: the value from the command line :returns: the orignal value split at "," if the fields are spelled correctly :throws: argparse.ArgumentTypeError .. function:: comma_separated_argument(original: str) -> List[str] Return the original string split by commas :param original: the value from the command line :returns: the original value split at "," and lower cased .. function:: create_parsers() -> Tuple[argparse.ArgumentParser, argparse.ArgumentParser] Create two argument parsers. The first parser is manly used to find the config file which can than be used to set some default values on the second parser. The second parser can parse the remainder of the command line with the subcommand and all further options and arguments. :returns: the two parsers for the first and the second parsing pass :rtype: (argparse.ArgumentParser, argparse.ArgumentParser) .. function:: parse_args(argv: List[str]) -> Tuple[argparse.Namespace, Config] Parse the command line arguments and return the namespace that was creates by argparse.ArgumentParser.parse_args(). :param argv: the command line arguments :returns: the namespace parsed from the command line .. function:: merge_args_into_config(args: argparse.Namespace, config: Config) -> Config Merge the parsed arguments from argparse into the config object. :param args: the parsed command line arguments :param config: the parsed config file :returns: the merged config object .. function:: init(argv: List[str]) -> Tuple[argparse.Namespace, Config] Initialize khard by parsing the command line and reading the config file :param argv: the command line arguments :returns: the parsed command line and the fully initialized config