]> Sergey Matveev's repositories - nnn.git/commitdiff
Option -r to show cp, mv progress on Linux
authorArun Prakash Jana <engineerarun@gmail.com>
Fri, 23 Aug 2019 14:48:17 +0000 (20:18 +0530)
committerArun Prakash Jana <engineerarun@gmail.com>
Fri, 23 Aug 2019 14:58:56 +0000 (20:28 +0530)
README.md
misc/auto-completion/bash/nnn-completion.bash
misc/auto-completion/fish/nnn.fish
misc/auto-completion/zsh/_nnn
nnn.1
src/nnn.c

index 733615ad6d037aa648c25c1fde24388d7b45b9f5..6ffcb2b59da854d3b3c17ebe51450b7884cd95ca 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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
index cf5908400ed9799be344b2e2c712b01d6d50376a..698b588232452220e24e19fc3f2e384a5a0d6bd5 100644 (file)
@@ -19,6 +19,7 @@ _nnn () {
         -n
         -o
         -p
+        -r
         -s
         -S
         -t
index 5ec9cd58490defef530f0f65138ace6bce8a5d80..4dd91d27dc83e53656c0e36ec779e7c4ccecbd12 100644 (file)
@@ -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'
index 3bb3ff8aa14ff772471331f97a159f5fb395cc9f..3fb17391bab689348dc8b341ec4502b709ef367e 100644 (file)
@@ -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]'
diff --git a/nnn.1 b/nnn.1
index ab756d57f6afa480241e7748131aaaf66ec04ab9..bc5eabb5d874ca9f1ac05f918df9ea012a66f2c9 100644 (file)
--- a/nnn.1
+++ b/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
index 665fa658761e6ca160d6c6402662c2e3571f5cc6..2ef23f2d86e6aeae60652ee0016345667de198fc 100644 (file)
--- a/src/nnn.c
+++ b/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] = ' ';