forked from borgmatic-collective/borgmatic
Don't auto-add CLI flags for configuration options that already have per-action CLI flags (#303).
This commit is contained in:
@@ -288,6 +288,9 @@ def parse_arguments_for_actions(unparsed_arguments, action_parsers, global_parse
|
||||
)
|
||||
|
||||
|
||||
OMITTED_FLAG_NAMES = {'progress', 'stats', 'list'}
|
||||
|
||||
|
||||
def add_arguments_from_schema(arguments_group, schema, unparsed_arguments, names=None):
|
||||
'''
|
||||
Given an argparse._ArgumentGroup instance, a configuration schema dict, and a sequence of
|
||||
@@ -376,6 +379,11 @@ def add_arguments_from_schema(arguments_group, schema, unparsed_arguments, names
|
||||
|
||||
description = description.replace('%', '%%')
|
||||
|
||||
# These options already have corresponding flags on individual actions (like "create
|
||||
# --progress"), so don't bother adding them to the global flags.
|
||||
if flag_name in OMITTED_FLAG_NAMES:
|
||||
return
|
||||
|
||||
argument_type = borgmatic.config.schema.parse_type(schema_type)
|
||||
full_flag_name = f"--{flag_name.replace('_', '-')}"
|
||||
|
||||
|
||||
@@ -813,21 +813,24 @@ properties:
|
||||
type: boolean
|
||||
description: |
|
||||
Display progress as each file or archive is processed when running
|
||||
supported actions. Defaults to false.
|
||||
supported actions. Corresponds to the "--progress" flag on those
|
||||
actions. Defaults to false.
|
||||
default: false
|
||||
example: true
|
||||
stats:
|
||||
type: boolean
|
||||
description: |
|
||||
Display statistics for an archive when running supported actions.
|
||||
Defaults to false.
|
||||
Corresponds to the "--stats" flag on those actions. Defaults to
|
||||
false.
|
||||
default: false
|
||||
example: true
|
||||
list:
|
||||
type: boolean
|
||||
description: |
|
||||
Display details for each file or archive as it is processed when
|
||||
running supported actions. Defaults to false.
|
||||
running supported actions. Corresponds to the "--list" flag on those
|
||||
actions. Defaults to false.
|
||||
default: false
|
||||
example: true
|
||||
skip_actions:
|
||||
|
||||
Reference in New Issue
Block a user