mirror of
https://github.com/jarun/nnn.git
synced 2024-12-01 02:49:44 +00:00
Option -r to show cp, mv progress on Linux
This commit is contained in:
parent
979fadcc7e
commit
a4d8d68c7d
|
@ -203,13 +203,12 @@ Option completion scripts for Bash, Fish and Zsh can be found in respective subd
|
|||
| `NNN_IDLE_TIMEOUT=300` | idle seconds before locking terminal [default: disabled] |
|
||||
| `NNN_COPIER=copier` | clipboard copier script [default: none] |
|
||||
| `NNN_TRASH=1` | trash files to the desktop Trash [default: delete] |
|
||||
| `NNN_OPS_PROG=1` | show cp, mv progress on Linux (needs advcpmv) |
|
||||
|
||||
#### Cmdline options
|
||||
|
||||
```
|
||||
usage: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]
|
||||
[-p file] [-s] [-S] [-t] [-v] [-h] [PATH]
|
||||
[-p file] [-r] [-s] [-S] [-t] [-v] [-h] [PATH]
|
||||
|
||||
The missing terminal file manager for X.
|
||||
|
||||
|
@ -225,6 +224,7 @@ optional args:
|
|||
-n version sort
|
||||
-o press Enter to open files
|
||||
-p file selection file (stdout if '-')
|
||||
-r show cp, mv progress on Linux
|
||||
-s string filters [default: regex]
|
||||
-S du mode
|
||||
-t disable dir auto-select
|
||||
|
|
|
@ -19,6 +19,7 @@ _nnn () {
|
|||
-n
|
||||
-o
|
||||
-p
|
||||
-r
|
||||
-s
|
||||
-S
|
||||
-t
|
||||
|
|
|
@ -13,6 +13,7 @@ complete -c nnn -s i -d 'start in navigate-as-you-type mode'
|
|||
complete -c nnn -s n -d 'use version compare to sort files'
|
||||
complete -c nnn -s o -d 'open files only on Enter'
|
||||
complete -c nnn -s p -r -d 'copy selection to file'
|
||||
complete -c nnn -s r -d 'show cp, mv progress (Linux-only)'
|
||||
complete -c nnn -s s -d 'use substring match for filters'
|
||||
complete -c nnn -s S -d 'start in disk usage analyzer mode'
|
||||
complete -c nnn -s t -d 'disable dir auto-select'
|
||||
|
|
|
@ -17,6 +17,7 @@ args=(
|
|||
'(-n)-n[use version compare to sort files]'
|
||||
'(-o)-o[open files only on Enter]'
|
||||
'(-p)-p[copy selection to file]:file name'
|
||||
'(-r)-r[show cp, mv progress (Linux-only)]'
|
||||
'(-s)-s[use substring match for filters]'
|
||||
'(-S)-S[start in disk usage analyzer mode]'
|
||||
'(-t)-t[disable dir auto-select]'
|
||||
|
|
11
nnn.1
11
nnn.1
|
@ -13,6 +13,7 @@
|
|||
.Op Ar -i
|
||||
.Op Ar -n
|
||||
.Op Ar -p file
|
||||
.Op Ar -r
|
||||
.Op Ar -s
|
||||
.Op Ar -S
|
||||
.Op Ar -v
|
||||
|
@ -60,6 +61,9 @@ supports the following options:
|
|||
.Fl "p file"
|
||||
copy (or \fIpick\fR) selection to file, or stdout if file='-'
|
||||
.Pp
|
||||
.Fl r
|
||||
show cp, mv progress (Linux-only, needs advcpmv; '^T' shows the progress on BSD/macOS)
|
||||
.Pp
|
||||
.Fl s
|
||||
use substring match for filters instead of regex
|
||||
.Pp
|
||||
|
@ -191,13 +195,6 @@ files.
|
|||
.Bd -literal
|
||||
export NNN_TRASH=1
|
||||
.Ed
|
||||
.Pp
|
||||
\fBNNN_OPS_PROG:\fR show progress of copy, move operations (Linux-only, needs advcpmv).
|
||||
.Bd -literal
|
||||
export NNN_OPS_PROG=1
|
||||
|
||||
NOTE: BSD and macOS users can press '^T' to check the progress.
|
||||
.Ed
|
||||
.Sh KNOWN ISSUES
|
||||
If you are using urxvt you might have to set backspace key to DEC.
|
||||
.Sh AUTHORS
|
||||
|
|
21
src/nnn.c
21
src/nnn.c
|
@ -403,9 +403,6 @@ static const char * const messages[] = {
|
|||
#define NNNLVL 6 /* strings end here */
|
||||
#define NNN_USE_EDITOR 7 /* flags begin here */
|
||||
#define NNN_TRASH 8
|
||||
#ifdef __linux__
|
||||
#define NNN_OPS_PROG 9
|
||||
#endif
|
||||
|
||||
static const char * const env_cfg[] = {
|
||||
"NNN_BMS",
|
||||
|
@ -417,9 +414,6 @@ static const char * const env_cfg[] = {
|
|||
"NNNLVL",
|
||||
"NNN_USE_EDITOR",
|
||||
"NNN_TRASH",
|
||||
#ifdef __linux__
|
||||
"NNN_OPS_PROG",
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Required environment variables */
|
||||
|
@ -4565,7 +4559,7 @@ static void usage(void)
|
|||
{
|
||||
fprintf(stdout,
|
||||
"%s: nnn [-b key] [-d] [-e] [-H] [-i] [-n] [-o]\n"
|
||||
" [-p file] [-s] [-S] [-t] [-v] [-h] [PATH]\n\n"
|
||||
" [-p file] [-r] [-s] [-S] [-t] [-v] [-h] [PATH]\n\n"
|
||||
"The missing terminal file manager for X.\n\n"
|
||||
"positional args:\n"
|
||||
" PATH start dir [default: current dir]\n\n"
|
||||
|
@ -4578,6 +4572,7 @@ static void usage(void)
|
|||
" -n version sort\n"
|
||||
" -o press Enter to open files\n"
|
||||
" -p file selection file (stdout if '-')\n"
|
||||
" -r show cp, mv progress on Linux\n"
|
||||
" -s string filters [default: regex]\n"
|
||||
" -S du mode\n"
|
||||
" -t disable dir auto-select\n"
|
||||
|
@ -4711,8 +4706,11 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
char *arg = NULL;
|
||||
int opt;
|
||||
#ifdef __linux__
|
||||
bool progress = FALSE;
|
||||
#endif
|
||||
|
||||
while ((opt = getopt(argc, argv, "HSib:denop:stvh")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "HSib:denop:rstvh")) != -1) {
|
||||
switch (opt) {
|
||||
case 'S':
|
||||
cfg.blkorder = 1;
|
||||
|
@ -4758,6 +4756,11 @@ int main(int argc, char *argv[])
|
|||
unlink(g_cppath);
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
#ifdef __linux__
|
||||
progress = TRUE;
|
||||
#endif
|
||||
break;
|
||||
case 's':
|
||||
cfg.filter_re = 0;
|
||||
filterfn = &visible_str;
|
||||
|
@ -4925,7 +4928,7 @@ int main(int argc, char *argv[])
|
|||
copier = getenv(env_cfg[NNN_COPIER]);
|
||||
|
||||
#ifdef __linux__
|
||||
if (!xgetenv_set(env_cfg[NNN_OPS_PROG])) {
|
||||
if (!progress) {
|
||||
cp[5] = cp[4];
|
||||
cp[2] = cp[4] = ' ';
|
||||
|
||||
|
|
Loading…
Reference in a new issue