diff --git a/misc/auto-completion/bash/nnn-completion.bash b/misc/auto-completion/bash/nnn-completion.bash index bd9382ad..e89e7dd0 100644 --- a/misc/auto-completion/bash/nnn-completion.bash +++ b/misc/auto-completion/bash/nnn-completion.bash @@ -15,6 +15,7 @@ _nnn () -a -A -b + -B -c -C -d diff --git a/misc/auto-completion/fish/nnn.fish b/misc/auto-completion/fish/nnn.fish index c3dc6e79..d195088e 100644 --- a/misc/auto-completion/fish/nnn.fish +++ b/misc/auto-completion/fish/nnn.fish @@ -14,6 +14,7 @@ end complete -c nnn -s a -d 'auto-create NNN_FIFO' complete -c nnn -s A -d 'disable dir auto-enter' complete -c nnn -s b -r -d 'bookmark key to open' -x -a '(echo $NNN_BMS | awk -F: -v RS=\; \'{print $1"\t"$2}\')' +complete -c nnn -s B -d 'use bsdtar for archives' complete -c nnn -s c -d 'cli-only opener' complete -c nnn -s C -d 'color by context' complete -c nnn -s d -d 'start in detail mode' diff --git a/misc/auto-completion/zsh/_nnn b/misc/auto-completion/zsh/_nnn index 293fd4fb..55eadab1 100644 --- a/misc/auto-completion/zsh/_nnn +++ b/misc/auto-completion/zsh/_nnn @@ -12,6 +12,7 @@ args=( '(-a)-a[auto-create NNN_FIFO]' '(-A)-A[disable dir auto-enter]' '(-b)-b[bookmark key to open]:key char' + '(-B)-B[use bsdtar for archives]' '(-c)-c[cli-only opener]' '(-C)-C[color by context]' '(-d)-d[start in detail mode]' diff --git a/nnn.1 b/nnn.1 index f8f4962b..1e998241 100644 --- a/nnn.1 +++ b/nnn.1 @@ -53,6 +53,9 @@ supports the following options: .Fl "b key" specify bookmark key to open .Pp +.Fl B + use bsdtar for archives (default: atool) +.Pp .Fl c indicates that the opener is a cli-only opener (overrides -e) .Pp diff --git a/src/nnn.c b/src/nnn.c index 54e99408..b10143a4 100644 --- a/src/nnn.c +++ b/src/nnn.c @@ -373,7 +373,8 @@ typedef struct { uint_t stayonsel : 1; /* Disable auto-advance on selection */ uint_t trash : 2; /* Trash method 0: rm -rf, 1: trash-cli, 2: gio trash */ uint_t uidgid : 1; /* Show owner and group info */ - uint_t reserved : 6; /* Adjust when adding/removing a field */ + uint_t usebsdtar : 1; /* Use bsdtar as default archive utility */ + uint_t reserved : 5; /* Adjust when adding/removing a field */ } runstate; /* Contexts or workspaces */ @@ -2670,7 +2671,7 @@ static void get_archive_cmd(char *cmd, const char *archive) { uchar_t i = 3; - if (getutil(utils[UTIL_ATOOL])) + if (!g_state.usebsdtar && getutil(utils[UTIL_ATOOL])) i = 0; else if (getutil(utils[UTIL_BSDTAR])) i = 1; @@ -4573,7 +4574,7 @@ static bool handle_archive(char *fpath /* in-out param */, char op) char arg[] = "-tvf"; /* options for tar/bsdtar to list files */ char *util, *outdir = NULL; bool x_to = FALSE; - bool is_atool = getutil(utils[UTIL_ATOOL]); + bool is_atool = (!g_state.usebsdtar && getutil(utils[UTIL_ATOOL])); if (op == 'x') { outdir = xreadline(is_atool ? "." : xbasename(fpath), messages[MSG_NEW_PATH]); @@ -8095,6 +8096,7 @@ static void usage(void) #endif " -A no dir auto-enter during filter\n" " -b key open bookmark key (trumps -s/S)\n" + " -B use bsdtar for archives\n" " -c cli-only NNN_OPENER (trumps -e)\n" " -C 8-color scheme\n" " -d detail mode\n" @@ -8290,7 +8292,7 @@ int main(int argc, char *argv[]) while ((opt = (env_opts_id > 0 ? env_opts[--env_opts_id] - : getopt(argc, argv, "aAb:cCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) { + : getopt(argc, argv, "aAb:BcCdDeEfF:gHiJKl:nop:P:QrRs:St:T:uUVxh"))) != -1) { switch (opt) { #ifndef NOFIFO case 'a': @@ -8304,6 +8306,9 @@ int main(int argc, char *argv[]) if (env_opts_id < 0) arg = optarg; break; + case 'B': + g_state.usebsdtar = 1; + break; case 'c': cfg.cliopener = 1; break;