Merge ssh://projects.torsion.org:3022/witten/borgmatic
This commit is contained in:
commit
5d8ac158ce
3 changed files with 7 additions and 3 deletions
|
@ -92,6 +92,8 @@ def parse_arguments(*arguments):
|
|||
parser.add_argument(
|
||||
'-v', '--verbosity',
|
||||
type=int,
|
||||
choices=range(0,3),
|
||||
default=0,
|
||||
help='Display verbose progress (1 for some, 2 for lots)',
|
||||
)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def test_parse_arguments_with_no_arguments_uses_defaults():
|
|||
|
||||
assert parser.config_paths == config_paths
|
||||
assert parser.excludes_filename == None
|
||||
assert parser.verbosity is None
|
||||
assert parser.verbosity is 0
|
||||
assert parser.json is False
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ def test_parse_arguments_with_path_arguments_overrides_defaults():
|
|||
|
||||
assert parser.config_paths == ['myconfig']
|
||||
assert parser.excludes_filename == 'myexcludes'
|
||||
assert parser.verbosity is None
|
||||
assert parser.verbosity is 0
|
||||
|
||||
|
||||
def test_parse_arguments_with_multiple_config_paths_parses_as_list():
|
||||
|
@ -34,7 +34,7 @@ def test_parse_arguments_with_multiple_config_paths_parses_as_list():
|
|||
parser = module.parse_arguments('--config', 'myconfig', 'otherconfig')
|
||||
|
||||
assert parser.config_paths == ['myconfig', 'otherconfig']
|
||||
assert parser.verbosity is None
|
||||
assert parser.verbosity is 0
|
||||
|
||||
|
||||
def test_parse_arguments_with_verbosity_flag_overrides_default():
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
|
||||
|
||||
VERBOSITY_WARNING = 0
|
||||
VERBOSITY_SOME = 1
|
||||
VERBOSITY_LOTS = 2
|
||||
|
||||
|
@ -10,6 +11,7 @@ def verbosity_to_log_level(verbosity):
|
|||
Given a borgmatic verbosity value, return the corresponding Python log level.
|
||||
'''
|
||||
return {
|
||||
VERBOSITY_WARNING: logging.WARNING,
|
||||
VERBOSITY_SOME: logging.INFO,
|
||||
VERBOSITY_LOTS: logging.DEBUG,
|
||||
}.get(verbosity, logging.WARNING)
|
||||
|
|
Loading…
Reference in a new issue