mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
common options: more Highlander options, fixes #6269
This commit is contained in:
parent
971438dfa0
commit
12f9a26fad
2 changed files with 18 additions and 1 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
logger = create_logger()
|
||||
|
||||
from ._common import Highlander
|
||||
from .. import __version__
|
||||
from ..constants import * # NOQA
|
||||
from ..helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR, EXIT_SIGNAL_BASE
|
||||
|
@ -219,7 +220,15 @@ def add_common_group(self, parser, suffix, provide_defaults=False):
|
|||
def add_argument(*args, **kwargs):
|
||||
if "dest" in kwargs:
|
||||
kwargs.setdefault("action", "store")
|
||||
assert kwargs["action"] in ("help", "store_const", "store_true", "store_false", "store", "append")
|
||||
assert kwargs["action"] in (
|
||||
Highlander,
|
||||
"help",
|
||||
"store_const",
|
||||
"store_true",
|
||||
"store_false",
|
||||
"store",
|
||||
"append",
|
||||
)
|
||||
is_append = kwargs["action"] == "append"
|
||||
if is_append:
|
||||
self.append_options.add(kwargs["dest"])
|
||||
|
|
|
@ -508,6 +508,7 @@ def define_common_options(add_common_option):
|
|||
dest="lock_wait",
|
||||
type=int,
|
||||
default=int(os.environ.get("BORG_LOCK_WAIT", 1)),
|
||||
action=Highlander,
|
||||
help="wait at most SECONDS for acquiring a repository/cache lock (default: %(default)d).",
|
||||
)
|
||||
add_common_option(
|
||||
|
@ -525,12 +526,14 @@ def define_common_options(add_common_option):
|
|||
dest="umask",
|
||||
type=lambda s: int(s, 8),
|
||||
default=UMASK_DEFAULT,
|
||||
action=Highlander,
|
||||
help="set umask to M (local only, default: %(default)04o)",
|
||||
)
|
||||
add_common_option(
|
||||
"--remote-path",
|
||||
metavar="PATH",
|
||||
dest="remote_path",
|
||||
action=Highlander,
|
||||
help='use PATH as borg executable on the remote (default: "borg")',
|
||||
)
|
||||
add_common_option(
|
||||
|
@ -538,6 +541,7 @@ def define_common_options(add_common_option):
|
|||
metavar="RATE",
|
||||
dest="upload_ratelimit",
|
||||
type=int,
|
||||
action=Highlander,
|
||||
help="set network upload rate limit in kiByte/s (default: 0=unlimited)",
|
||||
)
|
||||
add_common_option(
|
||||
|
@ -545,6 +549,7 @@ def define_common_options(add_common_option):
|
|||
metavar="UPLOAD_BUFFER",
|
||||
dest="upload_buffer",
|
||||
type=int,
|
||||
action=Highlander,
|
||||
help="set network upload buffer size in MiB. (default: 0=no buffer)",
|
||||
)
|
||||
add_common_option(
|
||||
|
@ -552,6 +557,7 @@ def define_common_options(add_common_option):
|
|||
metavar="FILE",
|
||||
dest="debug_profile",
|
||||
default=None,
|
||||
action=Highlander,
|
||||
help="Write execution profile in Borg format into FILE. For local use a Python-"
|
||||
'compatible file can be generated by suffixing FILE with ".pyprof".',
|
||||
)
|
||||
|
@ -559,6 +565,7 @@ def define_common_options(add_common_option):
|
|||
"--rsh",
|
||||
metavar="RSH",
|
||||
dest="rsh",
|
||||
action=Highlander,
|
||||
help="Use this command to connect to the 'borg serve' process (default: 'ssh')",
|
||||
)
|
||||
add_common_option(
|
||||
|
@ -568,6 +575,7 @@ def define_common_options(add_common_option):
|
|||
dest="location",
|
||||
type=location_validator(other=False),
|
||||
default=Location(other=False),
|
||||
action=Highlander,
|
||||
help="repository to use",
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue