mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 16:41:41 +08:00
command: Rename -p/--path flag to -s/--search
This commit is contained in:
parent
cfa13ed84c
commit
72e8489d50
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 <tt>$PATH</tt>.
|
||||
- \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 <tt>$PATH</tt>.
|
||||
|
||||
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 <tt>command</tt>, the \c -v flag is recognized as an alias for <tt>-s</tt>.
|
||||
|
||||
\subsection command-example Examples
|
||||
|
||||
<tt>command ls</tt> causes fish to execute the \c ls program, even if an 'ls' function exists.
|
||||
|
||||
<tt>command -p ls</tt> returns the path to the \c ls program.
|
||||
<tt>command -s ls</tt> returns the path to the \c ls program.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user