Log a warning when "borgmatic borg" is run with an action that borgmatic natively supports (#694).
This commit is contained in:
parent
403ae0f698
commit
8eb05b840a
2 changed files with 10 additions and 1 deletions
2
NEWS
2
NEWS
|
@ -18,7 +18,7 @@
|
|||
--editable" development installs.
|
||||
* #691: Fix error in "borgmatic restore" action when the configured repository path is relative
|
||||
instead of absolute.
|
||||
* Run "borgmatic borg" action without capturing output so interactive prompts and flags like
|
||||
* #694: Run "borgmatic borg" action without capturing output so interactive prompts and flags like
|
||||
"--progress" still work.
|
||||
|
||||
1.7.12
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import logging
|
||||
|
||||
import borgmatic.commands.arguments
|
||||
import borgmatic.logger
|
||||
from borgmatic.borg import environment, flags
|
||||
from borgmatic.execute import DO_NOT_CAPTURE, execute_command
|
||||
|
@ -36,6 +37,14 @@ def run_arbitrary_borg(
|
|||
command_options_start_index = 2 if options[0] in BORG_SUBCOMMANDS_WITH_SUBCOMMANDS else 1
|
||||
borg_command = tuple(options[:command_options_start_index])
|
||||
command_options = tuple(options[command_options_start_index:])
|
||||
|
||||
if (
|
||||
borg_command
|
||||
and borg_command[0] in borgmatic.commands.arguments.SUBPARSER_ALIASES.keys()
|
||||
):
|
||||
logger.warning(
|
||||
f"Borg's {borg_command[0]} subcommand is supported natively by borgmatic. Try this instead: borgmatic {borg_command[0]}"
|
||||
)
|
||||
except IndexError:
|
||||
borg_command = ()
|
||||
command_options = ()
|
||||
|
|
Loading…
Reference in a new issue