mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 13:51:31 +00:00
Support archiving files in selection
This commit is contained in:
parent
2324e8e3e7
commit
d9977c5ea1
|
@ -236,7 +236,7 @@ Press <kbd>?</kbd> in `nnn` to see the list anytime.
|
||||||
Y Select all
|
Y Select all
|
||||||
P Copy selection X Delete selection
|
P Copy selection X Delete selection
|
||||||
V Move selection ^X Delete entry
|
V Move selection ^X Delete entry
|
||||||
f Archive entry F List archive
|
f Archive files F List archive
|
||||||
^F Extract archive m M Brief/full media info
|
^F Extract archive m M Brief/full media info
|
||||||
e Edit in EDITOR p Open in PAGER
|
e Edit in EDITOR p Open in PAGER
|
||||||
ORDER TOGGLES
|
ORDER TOGGLES
|
||||||
|
|
2
nnn.1
2
nnn.1
|
@ -113,7 +113,7 @@ Delete files from selection
|
||||||
.It Ic ^X
|
.It Ic ^X
|
||||||
Delete entry
|
Delete entry
|
||||||
.It Ic f
|
.It Ic f
|
||||||
Archive entry
|
Archive files
|
||||||
.It Ic F
|
.It Ic F
|
||||||
List files in archive
|
List files in archive
|
||||||
.It Ic ^F
|
.It Ic ^F
|
||||||
|
|
20
src/nnn.c
20
src/nnn.c
|
@ -2300,7 +2300,7 @@ static bool show_help(char *path)
|
||||||
"cY Select all\n"
|
"cY Select all\n"
|
||||||
"cP Copy selection X Delete selection\n"
|
"cP Copy selection X Delete selection\n"
|
||||||
"cV Move selection ^X Delete entry\n"
|
"cV Move selection ^X Delete entry\n"
|
||||||
"cf Archive entry F List archive\n"
|
"cf Archive files F List archive\n"
|
||||||
"b^F Extract archive m M Brief/full media info\n"
|
"b^F Extract archive m M Brief/full media info\n"
|
||||||
"ce Edit in EDITOR p Open in PAGER\n"
|
"ce Edit in EDITOR p Open in PAGER\n"
|
||||||
"1ORDER TOGGLES\n"
|
"1ORDER TOGGLES\n"
|
||||||
|
@ -3512,7 +3512,7 @@ nochange:
|
||||||
{
|
{
|
||||||
switch (sel) {
|
switch (sel) {
|
||||||
case SEL_ARCHIVE:
|
case SEL_ARCHIVE:
|
||||||
tmp = xreadline(dents[cur].name, "name: ");
|
tmp = xreadline(NULL, "archive name: ");
|
||||||
break;
|
break;
|
||||||
case SEL_OPENWITH:
|
case SEL_OPENWITH:
|
||||||
tmp = xreadline(NULL, "open with: ");
|
tmp = xreadline(NULL, "open with: ");
|
||||||
|
@ -3545,9 +3545,23 @@ nochange:
|
||||||
/* newpath is used as temporary buffer */
|
/* newpath is used as temporary buffer */
|
||||||
if (!getutil(utils[APACK])) {
|
if (!getutil(utils[APACK])) {
|
||||||
printmsg("utility missing");
|
printmsg("utility missing");
|
||||||
continue;
|
goto nochange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r = get_input("archive selection (else current)? [s]");
|
||||||
|
if (r == 's') {
|
||||||
|
if (!cpsafe())
|
||||||
|
goto nochange;
|
||||||
|
|
||||||
|
snprintf(g_buf, CMD_LEN_MAX,
|
||||||
|
#ifdef __linux__
|
||||||
|
"xargs -0 -a %s %s %s",
|
||||||
|
#else
|
||||||
|
"cat %s | xargs -0 -o %s %s",
|
||||||
|
#endif
|
||||||
|
g_cppath, utils[APACK], tmp);
|
||||||
|
spawn("sh", "-c", g_buf, path, F_NORMAL | F_SIGINT);
|
||||||
|
} else
|
||||||
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
|
spawn(utils[APACK], tmp, dents[cur].name, path, F_NORMAL);
|
||||||
break;
|
break;
|
||||||
case SEL_OPENWITH:
|
case SEL_OPENWITH:
|
||||||
|
|
Loading…
Reference in a new issue