support more flags

This commit is contained in:
Divyansh Singh 2023-06-01 16:53:34 +05:30
parent 4c60bf84d7
commit 74aa28e027
2 changed files with 13 additions and 10 deletions

View file

@ -12,7 +12,7 @@ from borgmatic.borg.state import DEFAULT_BORGMATIC_SOURCE_DIRECTORY
logger = logging.getLogger(__name__)
def get_config_paths(bootstrap_arguments, global_arguments, local_borg_version):
borgmatic_source_directory = DEFAULT_BORGMATIC_SOURCE_DIRECTORY
borgmatic_source_directory = bootstrap_arguments.borgmatic_source_directory or DEFAULT_BORGMATIC_SOURCE_DIRECTORY
borgmatic_manifest_path = os.path.expanduser(
os.path.join(borgmatic_source_directory, 'bootstrap', 'configs-list.json')
)
@ -34,7 +34,11 @@ def get_config_paths(bootstrap_arguments, global_arguments, local_borg_version):
extract_to_stdout=True,
)
try:
manifest_data = json.loads(extract_process.stdout.read())
except json.decoder.JSONDecodeError as error:
logger.error('Error parsing manifest data: %s', error)
raise
return manifest_data['config_paths']
@ -66,6 +70,9 @@ def run_bootstrap(bootstrap_arguments, global_arguments, local_borg_version):
local_borg_version,
global_arguments,
extract_to_stdout=False,
destination_path=bootstrap_arguments.destination,
strip_components=bootstrap_arguments.strip_components,
progress=bootstrap_arguments.progress,
)

View file

@ -577,21 +577,17 @@ def make_parsers():
required=True,
)
config_bootstrap_group.add_argument(
'--archive', help='Name of archive to extract, defaults to "latest"'
'--borgmatic-source-directory',
help='Path of the borgmatic source directory if other than the default',
)
config_bootstrap_group.add_argument(
'--path',
'--restore-path',
metavar='PATH',
nargs='+',
dest='paths',
help='Paths to extract from archive, defaults to the entire archive',
'--archive', help='Name of archive to extract, defaults to "latest"'
)
config_bootstrap_group.add_argument(
'--destination',
metavar='PATH',
dest='destination',
help='Directory to extract files into, defaults to the current directory',
help='Directory to extract files into, defaults to /',
)
config_bootstrap_group.add_argument(
'--strip-components',