dav_tools¶
Python library to aid in software development.
Submodules¶
Attributes¶
Argument parser instance -- use this instead of importing the |
Classes¶
Customized argument parser. |
Package Contents¶
- class dav_tools._ArgumentParser¶
Customized argument parser.
Options and/or flags can be easily added, optionally inside (exclusive) groups. Some flags are automatically set.
Command line options are parsed when calling for the first time the args property.
- set_version(version)¶
Add a
--versionoption, which automatically displays project version.- Parameters:
version (str) – Current project version to display.
- Return type:
None
- set_description(description)¶
Set a brief description of the program, to be displayed on top when using the –help flag.
- Parameters:
description (str) – A description of the program
- Return type:
None
- set_developer_info(name, email)¶
Set information about the developer of the project. These informations will be displayed at the bottom of the –help command.
- Parameters:
name (str) – Name to be displayed
email (str) – Email address to be displayed
- Return type:
None
- property args: argparse.Namespace¶
Parse and return arguments specified on command line.
- Returns:
The arguments
- Return type:
argparse.Namespace
- parse_args()¶
Parse command line arguments and store them in the
argsproperty.- Return type:
None
- __group(name, description=None)¶
Return an argument group, or create it if it doesn’t exist.
- Parameters:
name (str) – Name of the group
description (str | None) – Group description
- Returns:
The argument group
- Return type:
argparse._ArgumentGroup
- add_mutually_exclusive_group(parent=None)¶
Create a mutually exclusive argument group. Only one option from this group can be used at a time.
- Parameters:
parent (argparse._ArgumentGroup | argparse.ArgumentParser | None) – If specified, create the new group as subgroup of parent, otherwise create it at top level
- Returns:
The new mutually exclusive group
- Return type:
argparse._MutuallyExclusiveGroup
- add_argument(*name_or_flags, group=None, **kwargs)¶
Add an argument to the parser.
- Parameters:
name_or_flags – Name or flags of the new argument. These options are directly passed to the argparse library.
group (argparse.ArgumentParser | argparse._ArgumentGroup | argparse._MutuallyExclusiveGroup | str | None) – Group in which to create the new argument. Can also be specified in string format.
kwargs – Additional options to be passed to the underlying argparse library.
- Return type:
None
- add_quiet_mode()¶
Add a
--quietswitch, which can be used in the program to suppress some output. Group and description are automatically set.- Return type:
None
- add_verbose_mode()¶
Add a
--verboseswitch, which can be used in the program to produce more output. Group and description are automatically set.- Return type:
None
- dav_tools.argument_parser¶
Argument parser instance – use this instead of importing the
_arg_parsermodule.