datalad.cmdline.helpers
- class datalad.cmdline.helpers.ArgumentParserDisableAbbrev(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]
Bases:
argparse.ArgumentParser
- class datalad.cmdline.helpers.HelpAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
Bases:
argparse.Action
- class datalad.cmdline.helpers.LogLevelAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]
Bases:
argparse.Action
- datalad.cmdline.helpers.fail_with_short_help(parser=None, msg=None, known=None, provided=None, hint=None, exit_code=1, what='command', out=None)[source]
Generic helper to fail with short help possibly hinting on what was intended if known were provided
- datalad.cmdline.helpers.get_commands_from_groups(groups)[source]
Get a dictionary of command: interface_spec
- datalad.cmdline.helpers.get_description_with_cmd_summary(grp_short_descriptions, interface_groups, parser_description)[source]
- datalad.cmdline.helpers.get_repo_instance(path='.', class_=None)[source]
Returns an instance of appropriate datalad repository for path. Check whether a certain path is inside a known type of repository and returns an instance representing it. May also check for a certain type instead of detecting the type of repository.
Deprecated since version 0.16: Use the pattern Dataset(get_dataset_root(path)).repo instead. This function will be removed in a future release.
- Parameters
path (str) – path to check; default: current working directory
class (class) – if given, check whether path is inside a repository, that can be represented as an instance of the passed class.
- Raises
RuntimeError, in case cwd is not inside a known repository. –
- datalad.cmdline.helpers.parser_add_version_opt(parser, mod_name, include_name=False, delay=False)[source]
Setup –version option
- Parameters
parser –
mod_name (str, optional) –
include_name (bool, optional) –
delay (bool, optional) – If set to True, no action is taken immediately, and rather we assign the function which would print the version. Necessary for early pre-parsing of the cmdline