mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-08 16:23:42 -04:00
completion: blacken
This commit is contained in:
parent
5968382c9b
commit
895feaa71a
1 changed files with 21 additions and 43 deletions
|
|
@ -56,7 +56,16 @@ import shtab
|
|||
|
||||
from ._common import process_epilog
|
||||
from ..constants import * # NOQA
|
||||
from ..helpers import archivename_validator, SortBySpec, FilesCacheMode, PathSpec, ChunkerParams, tag_validator, relative_time_marker_validator, parse_file_size
|
||||
from ..helpers import (
|
||||
archivename_validator,
|
||||
SortBySpec,
|
||||
FilesCacheMode,
|
||||
PathSpec,
|
||||
ChunkerParams,
|
||||
tag_validator,
|
||||
relative_time_marker_validator,
|
||||
parse_file_size,
|
||||
)
|
||||
from ..helpers.time import timestamp
|
||||
from ..compress import CompressionSpec
|
||||
from ..helpers.parseformat import partial_format
|
||||
|
|
@ -368,9 +377,11 @@ _borg_complete_archive() {
|
|||
# Use tab as delimiter to avoid issues with spaces in archive names
|
||||
local out
|
||||
if (( ${#repo_arg[@]} > 0 )); then
|
||||
out=$( borg repo-list "${repo_arg[@]}" --format '{id}{TAB}{archive}{TAB}{time}{TAB}{username}@{hostname}{NL}' 2>/dev/null </dev/null )
|
||||
out=$( borg repo-list "${repo_arg[@]}" --format '{id}{TAB}{archive}{TAB}{time}{TAB}{username}@{hostname}{NL}' \
|
||||
2>/dev/null </dev/null )
|
||||
else
|
||||
out=$( borg repo-list --format '{id}{TAB}{archive}{TAB}{time}{TAB}{username}@{hostname}{NL}' 2>/dev/null </dev/null )
|
||||
out=$( borg repo-list --format '{id}{TAB}{archive}{TAB}{time}{TAB}{username}@{hostname}{NL}' \
|
||||
2>/dev/null </dev/null )
|
||||
fi
|
||||
[[ -z "$out" ]] && return 0
|
||||
|
||||
|
|
@ -665,21 +676,15 @@ class CompletionMixIn:
|
|||
)
|
||||
_attach_completion(parser, PathSpec, shtab.DIRECTORY)
|
||||
_attach_completion(
|
||||
parser,
|
||||
ChunkerParams,
|
||||
{"bash": "_borg_complete_chunker_params", "zsh": "_borg_complete_chunker_params"},
|
||||
)
|
||||
_attach_completion(
|
||||
parser, tag_validator, {"bash": "_borg_complete_tags", "zsh": "_borg_complete_tags"}
|
||||
parser, ChunkerParams, {"bash": "_borg_complete_chunker_params", "zsh": "_borg_complete_chunker_params"}
|
||||
)
|
||||
_attach_completion(parser, tag_validator, {"bash": "_borg_complete_tags", "zsh": "_borg_complete_tags"})
|
||||
_attach_completion(
|
||||
parser,
|
||||
relative_time_marker_validator,
|
||||
{"bash": "_borg_complete_relative_time", "zsh": "_borg_complete_relative_time"},
|
||||
)
|
||||
_attach_completion(
|
||||
parser, timestamp, {"bash": "_borg_complete_timestamp", "zsh": "_borg_complete_timestamp"}
|
||||
)
|
||||
_attach_completion(parser, timestamp, {"bash": "_borg_complete_timestamp", "zsh": "_borg_complete_timestamp"})
|
||||
_attach_completion(
|
||||
parser, parse_file_size, {"bash": "_borg_complete_file_size", "zsh": "_borg_complete_file_size"}
|
||||
)
|
||||
|
|
@ -701,46 +706,19 @@ class CompletionMixIn:
|
|||
help_choices = " ".join(sorted(help_choices))
|
||||
|
||||
# Compression spec choices (static list)
|
||||
comp_spec_choices = [
|
||||
"lz4",
|
||||
"zstd,3",
|
||||
"auto,zstd,10",
|
||||
"zlib,6",
|
||||
"lzma,6",
|
||||
"obfuscate,250,lz4",
|
||||
"none",
|
||||
]
|
||||
comp_spec_choices = ["lz4", "zstd,3", "auto,zstd,10", "zlib,6", "lzma,6", "obfuscate,250,lz4", "none"]
|
||||
comp_spec_choices_str = " ".join(comp_spec_choices)
|
||||
|
||||
# Chunker params choices (static list)
|
||||
chunker_params_choices = [
|
||||
"default",
|
||||
"fixed,4194304",
|
||||
"buzhash,19,23,21,4095",
|
||||
"buzhash64,19,23,21,4095",
|
||||
]
|
||||
chunker_params_choices = ["default", "fixed,4194304", "buzhash,19,23,21,4095", "buzhash64,19,23,21,4095"]
|
||||
chunker_params_choices_str = " ".join(chunker_params_choices)
|
||||
|
||||
# Relative time marker choices (static list)
|
||||
relative_time_choices = [
|
||||
"60S",
|
||||
"60M",
|
||||
"24H",
|
||||
"7d",
|
||||
"4w",
|
||||
"12m",
|
||||
"1000y",
|
||||
]
|
||||
relative_time_choices = ["60S", "60M", "24H", "7d", "4w", "12m", "1000y"]
|
||||
relative_time_choices_str = " ".join(relative_time_choices)
|
||||
|
||||
# File size choices (static list)
|
||||
file_size_choices = [
|
||||
"500M",
|
||||
"1G",
|
||||
"10G",
|
||||
"100G",
|
||||
"1T",
|
||||
]
|
||||
file_size_choices = ["500M", "1G", "10G", "100G", "1T"]
|
||||
file_size_choices_str = " ".join(file_size_choices)
|
||||
|
||||
mapping = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue