mirror of
https://github.com/netinvent/npbackup.git
synced 2025-10-04 18:54:40 +08:00
CLI: Add --list-selected-repos command
This commit is contained in:
parent
1dd77265b0
commit
b22be2e6dc
1 changed files with 13 additions and 0 deletions
|
@ -83,6 +83,12 @@ This is free software, and you are welcome to redistribute it under certain cond
|
|||
required=False,
|
||||
help="Comme separated list of groups to work with. Can accept special name '__all__' to work with all repositories.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--list-selected-repos",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="List selected repositories and groups when using --repo-name and/or --repo-group.",
|
||||
)
|
||||
parser.add_argument("-b", "--backup", action="store_true", help="Run a backup")
|
||||
parser.add_argument(
|
||||
"-f",
|
||||
|
@ -445,6 +451,13 @@ This is free software, and you are welcome to redistribute it under certain cond
|
|||
# Cheap duplicate filter
|
||||
repos_and_group_repos = list(set(repos_and_group_repos))
|
||||
|
||||
if args.list_selected_repos:
|
||||
if _JSON:
|
||||
print(json.dumps({"result": True, "repositories": repos_and_group_repos}))
|
||||
else:
|
||||
logger.info(f"Repository list:\n{repos_and_group_repos}")
|
||||
sys.exit(0)
|
||||
|
||||
# Single repo usage
|
||||
if len(repos_and_group_repos) == 1:
|
||||
repo_config, _ = npbackup.configuration.get_repo_config(
|
||||
|
|
Loading…
Add table
Reference in a new issue