mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-11 23:47:25 +00:00
command: Rename -p/--path flag to -s/--search
This commit is contained in:
parent
cfa13ed84c
commit
72e8489d50
3 changed files with 10 additions and 7 deletions
|
@ -1067,7 +1067,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
static const struct woption
|
static const struct woption
|
||||||
long_options[] =
|
long_options[] =
|
||||||
{
|
{
|
||||||
{ L"path", no_argument, 0, 'p' },
|
{ L"search", no_argument, 0, 's' },
|
||||||
{ L"help", no_argument, 0, 'h' },
|
{ L"help", no_argument, 0, 'h' },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -1078,7 +1078,7 @@ static int builtin_command(parser_t &parser, wchar_t **argv)
|
||||||
|
|
||||||
int opt = wgetopt_long(argc,
|
int opt = wgetopt_long(argc,
|
||||||
argv,
|
argv,
|
||||||
L"ph",
|
L"svh",
|
||||||
long_options,
|
long_options,
|
||||||
&opt_index);
|
&opt_index);
|
||||||
if (opt == -1)
|
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);
|
builtin_print_help(parser, argv[0], stdout_buffer);
|
||||||
return STATUS_BUILTIN_OK;
|
return STATUS_BUILTIN_OK;
|
||||||
|
|
||||||
case 'p':
|
case 's':
|
||||||
|
case 'v':
|
||||||
print_path=1;
|
print_path=1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,14 @@
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
- \c -h or \c --help prints help and then exits.
|
- \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
|
\subsection command-example Examples
|
||||||
|
|
||||||
<tt>command ls</tt> causes fish to execute the \c ls program, even if an 'ls' function exists.
|
<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
|
set -l paths
|
||||||
if test $multi != yes
|
if test $multi != yes
|
||||||
set paths (command -p $i)
|
set paths (command -s $i)
|
||||||
else
|
else
|
||||||
set paths (which -a $i ^/dev/null)
|
set paths (which -a $i ^/dev/null)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue