khard.cli module

Command line parsing and configuration logic for khard

khard.cli.create_parsers()

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
Return type:(argparse.ArgumentParser, argparse.ArgumentParser)
khard.cli.init(argv)

Initialize khard by parsing the command line and reading the config file

Parameters:argv (list(str)) – the command line arguments
Returns:the parsed command line and the fully initialized config
Return type:(argparse.Namespace, Config)
khard.cli.merge_args_into_config(args, config)

Merge the parsed arguments from argparse into the config object.

Parameters:
  • args (argparse.Namespace) – the parsed command line arguments
  • config (config.Config) – the parsed config file
Returns:

the merged config object

Return type:

config.Config

khard.cli.parse_args(argv)

Parse the command line arguments and return the namespace that was creates by argparse.ArgumentParser.parse_args().

Parameters:argv (list(str)) – the command line arguments
Returns:the namespace parsed from the command line
Return type:argparse.Namespace