From 72e8489d50d749c86d5b57609bb0c4d83a03b41a Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 10 Jul 2014 19:16:32 -0700 Subject: [PATCH] command: Rename -p/--path flag to -s/--search --- builtin.cpp | 7 ++++--- doc_src/command.txt | 8 +++++--- share/functions/type.fish | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/builtin.cpp b/builtin.cpp index 2d3eb749d..6f7cc33c6 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -1067,7 +1067,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv) static const struct woption long_options[] = { - { L"path", no_argument, 0, 'p' }, + { L"search", no_argument, 0, 's' }, { L"help", no_argument, 0, 'h' }, { 0, 0, 0, 0 } }; @@ -1078,7 +1078,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv) int opt = wgetopt_long(argc, argv, - L"ph", + L"svh", long_options, &opt_index); if (opt == -1) @@ -1100,7 +1100,8 @@ static int builtin_command(parser_t &parser, wchar_t **argv) builtin_print_help(parser, argv[0], stdout_buffer); return STATUS_BUILTIN_OK; - case 'p': + case 's': + case 'v': print_path=1; break; diff --git a/doc_src/command.txt b/doc_src/command.txt index e93f34b8e..cef08fdc5 100644 --- a/doc_src/command.txt +++ b/doc_src/command.txt @@ -9,12 +9,14 @@ The following options are available: - \c -h or \c --help prints help and then exits. -- \c -p or \c --path returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the $PATH. +- \c -s or \c --search returns the name of the disk file that would be executed, or nothing if no file with the specified name could be found in the $PATH. -With the \c -p option, \c command treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found. +With the \c -s option, \c command treats every argument as a separate command to look up and sets the exit status to 0 if any of the specified commands were found, or 1 if no commands could be found. + +For basic compatibility with POSIX command, the \c -v flag is recognized as an alias for -s. \subsection command-example Examples command ls causes fish to execute the \c ls program, even if an 'ls' function exists. -command -p ls returns the path to the \c ls program. +command -s ls returns the path to the \c ls program. diff --git a/share/functions/type.fish b/share/functions/type.fish index 06e94abbe..8992d6b22 100644 --- a/share/functions/type.fish +++ b/share/functions/type.fish @@ -96,7 +96,7 @@ function type --description "Print the type of a command" set -l paths if test $multi != yes - set paths (command -p $i) + set paths (command -s $i) else set paths (which -a $i ^/dev/null) end