CLI#
Console script for remote_compression.
- class remote_compression.cli.DefaultGroup(name: str | None = None, commands: MutableMapping[str, Command] | Sequence[Command] | None = None, invoke_without_command: bool = False, no_args_is_help: bool | None = None, subcommand_metavar: str | None = None, chain: bool = False, result_callback: Callable[[...], Any] | None = None, **kwargs: Any)[source]#
Group that routes to the
runsubcommand when the first token is not a known subcommand:rcomp movies/andrcomp -P hard .keep working. Side effect: a target literally named like a subcommand needsrcomp run <target>.
- class remote_compression.cli.PathArg(exists: bool = False, file_okay: bool = True, dir_okay: bool = True, writable: bool = False, readable: bool = True, resolve_path: bool = False, allow_dash: bool = False, path_type: type | None = None, executable: bool = False)[source]#
click.Paththat repairs the PowerShell trailing-backslash accident.rcomp '.\dir\'reaches the program as.\dir"because Windows argument parsing reads the final\"as an escaped quote. A double quote being illegal in Windows file names, a trailing one is always that accident: strip it before validating.- convert(value, param, ctx)[source]#
Convert the value to the correct type. This is not called if the value is
None(the missing value).This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.
The
paramandctxarguments may beNonein certain situations, such as when converting prompt input.If the value cannot be converted, call
fail()with a descriptive message.- Parameters:
value – The value to convert.
param – The parameter that is using this type to convert its value. May be
None.ctx – The current context that arrived at this value. May be
None.
- remote_compression.cli.parse_age(text)[source]#
Parse a human age into a
timedelta.- Parameters:
text (
str) –90m,36h,7d; a bare number means hours.
Examples
>>> parse_age('90m') datetime.timedelta(seconds=5400) >>> parse_age('7d') datetime.timedelta(days=7) >>> parse_age('24') datetime.timedelta(days=1)