Combine archive operations

This commit is contained in:
Arun Prakash Jana 2019-12-10 03:56:38 +05:30
parent 8dd1946d1d
commit 847bda4380
No known key found for this signature in database
GPG Key ID: A75979F35C080412
3 changed files with 24 additions and 28 deletions

View File

@ -223,8 +223,7 @@ The list below is from the **dev branch**. Press <kbd>?</kbd> in `nnn` to see th
P Copy selection K Edit, flush sel P Copy selection K Edit, flush sel
V Move selection w Copy/move sel as V Move selection w Copy/move sel as
X Del selection ^X Del entry X Del selection ^X Del entry
f Create archive T Mount archive f Archive o ^F Archive ops
^F Extract archive F List archive
e Edit in EDITOR p Open in PAGER e Edit in EDITOR p Open in PAGER
ORDER TOGGLES ORDER TOGGLES
A Apparent du S du A Apparent du S du

View File

@ -456,6 +456,7 @@ static char * const utils[] = {
#define MSG_REMOTE_OPTS 39 #define MSG_REMOTE_OPTS 39
#define MSG_RCLONE_DELAY 40 #define MSG_RCLONE_DELAY 40
#define MSG_APP_NAME 41 #define MSG_APP_NAME 41
#define MSG_ARCHIVE_OPTS 42
static const char * const messages[] = { static const char * const messages[] = {
"no traversal", "no traversal",
@ -500,6 +501,7 @@ static const char * const messages[] = {
"'s'shfs / 'r'clone?", "'s'shfs / 'r'clone?",
"may take a while, try refresh", "may take a while, try refresh",
"app name: ", "app name: ",
"e'x'tract / 'l'ist / 'm'ount?",
}; };
/* Supported configuration environment variables */ /* Supported configuration environment variables */
@ -3506,8 +3508,7 @@ static void show_help(const char *path)
"cP Copy selection K Edit, flush sel\n" "cP Copy selection K Edit, flush sel\n"
"cV Move selection w Copy/move sel as\n" "cV Move selection w Copy/move sel as\n"
"cX Del selection ^X Del entry\n" "cX Del selection ^X Del entry\n"
"cf Create archive T Mount archive\n" "cf Archive o ^F Archive ops\n"
"b^F Extract archive F List archive\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"
"cA Apparent du S du\n" "cA Apparent du S du\n"
@ -4775,8 +4776,6 @@ nochange:
} }
} }
break; break;
case SEL_ARCHIVELS: // fallthrough
case SEL_EXTRACT: // fallthrough
case SEL_REDRAW: // fallthrough case SEL_REDRAW: // fallthrough
case SEL_RENAMEMUL: // fallthrough case SEL_RENAMEMUL: // fallthrough
case SEL_HELP: // fallthrough case SEL_HELP: // fallthrough
@ -4788,19 +4787,10 @@ nochange:
if (ndents) if (ndents)
mkpath(path, dents[cur].name, newpath); mkpath(path, dents[cur].name, newpath);
else if (sel == SEL_ARCHIVELS || sel == SEL_EXTRACT else if (sel == SEL_RUNEDIT || sel == SEL_RUNPAGE)
|| sel == SEL_RUNEDIT || sel == SEL_RUNPAGE)
break; break;
switch (sel) { switch (sel) {
case SEL_ARCHIVELS:
handle_archive(newpath, path, 'l');
refresh = TRUE;
break;
case SEL_EXTRACT:
handle_archive(newpath, path, 'x');
refresh = TRUE;
break;
case SEL_REDRAW: case SEL_REDRAW:
refresh = TRUE; refresh = TRUE;
break; break;
@ -5010,9 +5000,10 @@ nochange:
} }
tmp = NULL; tmp = NULL;
} else if (!ndents) } else if (r != 'c' || !ndents) {
clearprompt();
goto nochange; goto nochange;
else } else
tmp = dents[cur].name; tmp = dents[cur].name;
tmp = xreadline(tmp, messages[MSG_ARCHIVE_NAME]); tmp = xreadline(tmp, messages[MSG_ARCHIVE_NAME]);
break; break;
@ -5305,8 +5296,19 @@ nochange:
/* Repopulate as directory content may have changed */ /* Repopulate as directory content may have changed */
goto begin; goto begin;
case SEL_ARCHIVEMNT: case SEL_ARCHIVEOPS:
if (!ndents || !archive_mount(dents[cur].name, path, newpath, &presel)) if (!ndents)
goto nochange;
r = get_input(messages[MSG_ARCHIVE_OPTS]);
if (r == 'l' || r == 'x') {
mkpath(path, dents[cur].name, newpath);
handle_archive(newpath, path, r);
copycurname();
goto begin;
}
if (r != 'm' || !archive_mount(dents[cur].name, path, newpath, &presel))
goto nochange; // fallthrough goto nochange; // fallthrough
case SEL_REMOTE: case SEL_REMOTE:
if (sel == SEL_REMOTE && !remote_mount(newpath, &presel)) if (sel == SEL_REMOTE && !remote_mount(newpath, &presel))

View File

@ -67,8 +67,6 @@ enum action {
SEL_DETAIL, SEL_DETAIL,
SEL_STATS, SEL_STATS,
SEL_ARCHIVE, SEL_ARCHIVE,
SEL_ARCHIVELS,
SEL_EXTRACT,
SEL_FSIZE, /* file size */ SEL_FSIZE, /* file size */
SEL_ASIZE, /* apparent size */ SEL_ASIZE, /* apparent size */
SEL_BSIZE, /* block size */ SEL_BSIZE, /* block size */
@ -89,7 +87,7 @@ enum action {
SEL_NEW, SEL_NEW,
SEL_RENAME, SEL_RENAME,
SEL_RENAMEMUL, SEL_RENAMEMUL,
SEL_ARCHIVEMNT, SEL_ARCHIVEOPS,
SEL_REMOTE, SEL_REMOTE,
SEL_UMOUNT, SEL_UMOUNT,
SEL_HELP, SEL_HELP,
@ -186,10 +184,6 @@ static struct key bindings[] = {
{ 'D', SEL_STATS }, { 'D', SEL_STATS },
/* Create archive */ /* Create archive */
{ 'f', SEL_ARCHIVE }, { 'f', SEL_ARCHIVE },
/* List archive */
{ 'F', SEL_ARCHIVELS },
/* Extract archive */
{ CONTROL('F'), SEL_EXTRACT },
/* Toggle sort by size */ /* Toggle sort by size */
{ 'z', SEL_FSIZE }, { 'z', SEL_FSIZE },
/* Sort by apparent size including dir contents */ /* Sort by apparent size including dir contents */
@ -235,7 +229,8 @@ static struct key bindings[] = {
/* Rename contents of current dir */ /* Rename contents of current dir */
{ 'r', SEL_RENAMEMUL }, { 'r', SEL_RENAMEMUL },
/* Mount an archive */ /* Mount an archive */
{ 'T', SEL_ARCHIVEMNT }, { 'o', SEL_ARCHIVEOPS },
{ CONTROL('F'), SEL_ARCHIVEOPS },
/* Connect to server over SSHFS */ /* Connect to server over SSHFS */
{ 'c', SEL_REMOTE }, { 'c', SEL_REMOTE },
/* Disconnect a SSHFS mount point */ /* Disconnect a SSHFS mount point */