pycldf.cli_util
Functionality to use in commandline tools which need to access CLDF datasets.
- class pycldf.cli_util.FlagOrPathType(must_exist=True, type=None)[source]
- Parameters:
must_exist (
bool
) –type (
typing.Optional
[str
]) –
- class pycldf.cli_util.UrlOrPathType(must_exist=True, type=None)[source]
- Parameters:
must_exist (
bool
) –type (
typing.Optional
[str
]) –
- pycldf.cli_util.add_dataset(parser)[source]
Adds a positional argument named dataset to the parser to specify a CLDF dataset.
- Parameters:
parser (
argparse.ArgumentParser
) –
- pycldf.cli_util.get_dataset(args)[source]
Uses the dataset specification in args to return a corresponding Dataset instance.
- Parameters:
args (
argparse.Namespace
) –- Return type:
- pycldf.cli_util.strtobool(val)[source]
Convert a string representation of truth to true (1) or false (0).
True values are ‘y’, ‘yes’, ‘t’, ‘true’, ‘on’, and ‘1’; false values are ‘n’, ‘no’, ‘f’, ‘false’, ‘off’, and ‘0’. Raises ValueError if ‘val’ is anything else.
- Parameters:
val (
str
) –- Return type:
int