server: Deprecate ls -p.
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 24 Aug 2016 20:18:36 +0000 (22:18 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 25 Sep 2016 08:38:49 +0000 (10:38 +0200)
In v0.6.0 the -p option will have the same meaning as for the rm and
touch commands: perform pathname match. Also the default for the ls
command will be changed to list full paths while the new -b option
must be given to print only the basename (i.e., the current behaviour
if -p is not given).

This commit is a preparation for these incompatible changes which
does not break existing scripts. It does the following

* The -p option is deprecated in favor of its synonym, the new -F
option (for full path).

* The new -b option instructs the command to perform basename matching
and print only the basename of the matching files. It is currently
a no-op.

With the patch applied, scripts are supposed to specify either -b or
-F as appropriate.  In v0.6.0 the semantics of -p will be changed as
described above, the default will be changed to print the full path,
and -F will be deprecated because it is a no-op then.

afs.cmd
aft.c
client.c

diff --git a/afs.cmd b/afs.cmd
index 584ba809235c825cb9e1a3afdadd0644eea4d2c5..76b5f4dc82970d4bd2110ed8d9782cc8288dfb86 100644 (file)
--- a/afs.cmd
+++ b/afs.cmd
@@ -51,8 +51,13 @@ H:    p: parser-friendly mode
 H:    m: mbox listing mode
 H:    c: chunk-table listing mode
 H:
-H: -p  List full paths. If this option is not specified, only the basename
+H: -F  List full paths. If this option is not specified, only the basename
 H:     of each file is printed.
+H: -p  Synonym for -F. Deprecated.
+H:
+H: -b  Print only the basename of each matching file. This is the default, so
+H:     the option is currently a no-op. It is recommended to specify this option,
+H:     though, as the default might change in a future release.
 H:
 H: -a  List only files that are admissible with respect to the current mood or
 H:     playlist.
@@ -61,7 +66,8 @@ H: -r Reverse sort order.
 H:
 H: -d  Print dates as seconds after the epoch.
 H:
-H: -s=order    Change sort order. Defaults to alphabetical path sort if not given.
+H: -s=order
+H:     Change sort order. Defaults to alphabetical path sort if not given.
 H:
 H:   Possible values for order:
 H:   p: by path
diff --git a/aft.c b/aft.c
index f14440e6fb903548e25ccfdf611f4c2f2881aa49..df295246db0cf1d1d6e3d0b202d43c86332db0f6 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -1410,10 +1410,14 @@ int com_ls(struct command_context *cc)
                                return -E_AFT_SYNTAX;
                        }
                }
-               if (!strcmp(arg, "-p")) {
+               if (!strcmp(arg, "-p") || !strcmp(arg, "-F")) {
                        flags |= LS_FLAG_FULL_PATH;
                        continue;
                }
+               if (!strcmp(arg, "-b")) {
+                       flags &= ~LS_FLAG_FULL_PATH;
+                       continue;
+               }
                if (!strcmp(arg, "-a")) {
                        flags |= LS_FLAG_ADMISSIBLE_ONLY;
                        continue;
index 31cfff09798b2089e2b815a544fd207464f0e76c..64b1553745a53fc7a73db8901ea33a2c661204f2 100644 (file)
--- a/client.c
+++ b/client.c
@@ -278,7 +278,7 @@ static void ls_completer(struct i9e_completion_info *ci,
        char *opts[] = {
                "--", "-l", "-l=s", "-l=l", "-l=v", "-l=p", "-l=m", "-l=c",
                "-p", "-a", "-r", "-d", "-s=p", "-s=l", "-s=s", "-s=n", "-s=f",
-               "-s=c", "-s=i", "-s=y", "-s=b", "-s=d", "-s=a", NULL
+               "-s=c", "-s=i", "-s=y", "-s=b", "-s=d", "-s=a", "-F", "-b", NULL
        };
        if (ci->word[0] == '-')
                i9e_complete_option(opts, ci, cr);