mirror of https://github.com/borgbackup/borg.git
Merge pull request #4568 from ThomasWaldmann/placeholder-in-comments-master
enable placeholder usage in --comment, fixes #4559
This commit is contained in:
commit
92c9921468
|
@ -47,7 +47,7 @@ try:
|
||||||
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
from .helpers import EXIT_SUCCESS, EXIT_WARNING, EXIT_ERROR
|
||||||
from .helpers import Error, NoManifestError, set_ec
|
from .helpers import Error, NoManifestError, set_ec
|
||||||
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams, Location
|
from .helpers import positive_int_validator, location_validator, archivename_validator, ChunkerParams, Location
|
||||||
from .helpers import PrefixSpec, GlobSpec, SortBySpec, FilesCacheMode
|
from .helpers import PrefixSpec, GlobSpec, CommentSpec, SortBySpec, FilesCacheMode
|
||||||
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
from .helpers import BaseFormatter, ItemFormatter, ArchiveFormatter
|
||||||
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
from .helpers import format_timedelta, format_file_size, parse_file_size, format_archive
|
||||||
from .helpers import safe_encode, remove_surrogates, bin_to_hex, prepare_dump_dict
|
from .helpers import safe_encode, remove_surrogates, bin_to_hex, prepare_dump_dict
|
||||||
|
@ -2181,8 +2181,8 @@ class Archiver:
|
||||||
# don't backup the other home directories
|
# don't backup the other home directories
|
||||||
- /home/*\n\n''')
|
- /home/*\n\n''')
|
||||||
helptext['placeholders'] = textwrap.dedent('''
|
helptext['placeholders'] = textwrap.dedent('''
|
||||||
Repository (or Archive) URLs, ``--prefix``, ``--glob-archives`` and ``--remote-path``
|
Repository (or Archive) URLs, ``--prefix``, ``--glob-archives``, ``--comment``
|
||||||
values support these placeholders:
|
and ``--remote-path`` values support these placeholders:
|
||||||
|
|
||||||
{hostname}
|
{hostname}
|
||||||
The (short) hostname of the machine.
|
The (short) hostname of the machine.
|
||||||
|
@ -3026,7 +3026,7 @@ class Archiver:
|
||||||
'regular files. Also follows symlinks pointing to these kinds of files.')
|
'regular files. Also follows symlinks pointing to these kinds of files.')
|
||||||
|
|
||||||
archive_group = subparser.add_argument_group('Archive options')
|
archive_group = subparser.add_argument_group('Archive options')
|
||||||
archive_group.add_argument('--comment', dest='comment', metavar='COMMENT', default='',
|
archive_group.add_argument('--comment', dest='comment', metavar='COMMENT', type=CommentSpec, default='',
|
||||||
help='add a comment text to the archive')
|
help='add a comment text to the archive')
|
||||||
archive_group.add_argument('--timestamp', metavar='TIMESTAMP', dest='timestamp',
|
archive_group.add_argument('--timestamp', metavar='TIMESTAMP', dest='timestamp',
|
||||||
type=timestamp, default=None,
|
type=timestamp, default=None,
|
||||||
|
@ -3984,7 +3984,7 @@ class Archiver:
|
||||||
archive_group.add_argument('-c', '--checkpoint-interval', dest='checkpoint_interval',
|
archive_group.add_argument('-c', '--checkpoint-interval', dest='checkpoint_interval',
|
||||||
type=int, default=1800, metavar='SECONDS',
|
type=int, default=1800, metavar='SECONDS',
|
||||||
help='write checkpoint every SECONDS seconds (Default: 1800)')
|
help='write checkpoint every SECONDS seconds (Default: 1800)')
|
||||||
archive_group.add_argument('--comment', dest='comment', metavar='COMMENT', default=None,
|
archive_group.add_argument('--comment', dest='comment', metavar='COMMENT', type=CommentSpec, default=None,
|
||||||
help='add a comment text to the archive')
|
help='add a comment text to the archive')
|
||||||
archive_group.add_argument('--timestamp', metavar='TIMESTAMP', dest='timestamp',
|
archive_group.add_argument('--timestamp', metavar='TIMESTAMP', dest='timestamp',
|
||||||
type=timestamp, default=None,
|
type=timestamp, default=None,
|
||||||
|
|
|
@ -227,6 +227,8 @@ PrefixSpec = replace_placeholders
|
||||||
|
|
||||||
GlobSpec = replace_placeholders
|
GlobSpec = replace_placeholders
|
||||||
|
|
||||||
|
CommentSpec = replace_placeholders
|
||||||
|
|
||||||
|
|
||||||
def SortBySpec(text):
|
def SortBySpec(text):
|
||||||
from .manifest import AI_HUMAN_SORT_KEYS
|
from .manifest import AI_HUMAN_SORT_KEYS
|
||||||
|
|
Loading…
Reference in New Issue