From: Andre Noll Date: Wed, 24 Aug 2016 20:18:36 +0000 (+0200) Subject: server: Deprecate ls -p. X-Git-Tag: v0.5.7~13^2 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=2b9aa8a29a6bcc28a76289934d6dc6ca5606336f server: Deprecate ls -p. 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. --- diff --git a/afs.cmd b/afs.cmd index 584ba809..76b5f4dc 100644 --- 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 f14440e6..df295246 100644 --- 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; diff --git a/client.c b/client.c index 31cfff09..64b15537 100644 --- 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);