Merge branch 'master' into Integration_3.2.1

This commit is contained in:
David Adam 2021-03-16 18:00:36 +08:00
commit 0988d2fc15
10 changed files with 34 additions and 10 deletions

View File

@ -3556,7 +3556,7 @@ msgstr ""
#: /tmp/fish/explicit/share/functions/cdh.fish:5
msgid "Select directory by letter or number: "
msgstr "Sélectionner un dossier par lettre ou chiffre"
msgstr "Sélectionner un dossier par lettre ou chiffre : "
#: /tmp/fish/explicit/share/functions/cdh.fish:6
msgid ""

View File

@ -1923,8 +1923,8 @@ for file in $PATH/git-*
and continue
complete -C "git-$subcommand " >/dev/null
if [ (complete git-$subcommand | count) -gt 0 ]
complete git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
if [ (complete -c git-$subcommand | count) -gt 0 ]
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
end
set -a __fish_git_custom_commands_completion $subcommand
end

View File

@ -0,0 +1,12 @@
function __fish_mkpasswd_methods --description "Complete hashing methods for mkpasswd"
mkpasswd -m help | tail -n +2 | string replace -r '^(\S+)\s+(\S.*)' '$1\t$2'
echo -e "help\tList available methods"
end
complete -c mkpasswd -f
complete -c mkpasswd -s S -l salt -x -d 'Use given string as salt'
complete -c mkpasswd -s R -l rounds -x -d 'Use given number of rounds'
complete -c mkpasswd -s m -l method -xa "(__fish_mkpasswd_methods)" -d 'Compute the password using the given method'
complete -c mkpasswd -s 5 -d 'Like --method=md5crypt'
complete -c mkpasswd -s P -l password-fd -x -d 'Read the password from the given file descriptor'
complete -c mkpasswd -s s -l stdin -d 'Read the password from stdin'

View File

@ -1,2 +1,2 @@
complete source -k -xa '(__fish_complete_suffix .fish)'
complete source -s h -l help -d 'Display help and exit'
complete -c source -k -xa '(__fish_complete_suffix .fish)'
complete -c source -s h -l help -d 'Display help and exit'

View File

@ -10,7 +10,7 @@ function __fish_print_help --description "Print help message for the specified f
# Do nothing if the file does not exist
if not test -e "$__fish_data_dir/man/man1/$item.1" -o -e "$__fish_data_dir/man/man1/$item.1.gz"
return
return 2
end
# Render help output, save output into the variable 'help'

View File

@ -130,7 +130,7 @@ function funced --description 'Edit function definition'
end
set -l stat $status
rm $tmpname >/dev/null
command rm $tmpname >/dev/null
and rmdir $tmpdir >/dev/null
return $stat
end

View File

@ -155,7 +155,6 @@ int parse_help_only_cmd_opts(struct help_only_cmd_opts_t &opts, int *optind, int
/// Process and print help for the specified builtin or function.
void builtin_print_help(parser_t &parser, const io_streams_t &streams, const wchar_t *name,
wcstring *error_message) {
UNUSED(streams);
// This won't ever work if no_exec is set.
if (no_exec()) return;
const wcstring name_esc = escape_string(name, ESCAPE_ALL);
@ -166,8 +165,10 @@ void builtin_print_help(parser_t &parser, const io_streams_t &streams, const wch
// If it's an error, redirect the output of __fish_print_help to stderr
ios.push_back(std::make_shared<io_fd_t>(STDOUT_FILENO, STDERR_FILENO));
}
parser.eval(cmd, ios);
// ignore the exit status of __fish_print_help
auto res = parser.eval(cmd, ios);
if (res.status.exit_code() == 2) {
streams.err.append_format(BUILTIN_ERR_MISSING_HELP, name_esc.c_str());
}
}
/// Perform error reporting for encounter with unknown option.

View File

@ -36,6 +36,10 @@ enum { COMMAND_NOT_BUILTIN, BUILTIN_REGULAR, BUILTIN_FUNCTION };
/// Error message on missing argument.
#define BUILTIN_ERR_MISSING _(L"%ls: Expected argument for option %ls\n")
/// Error message on missing man page.
#define BUILTIN_ERR_MISSING_HELP \
_(L"fish: Missing man page for '%ls'. Did you install the documentation?\n")
/// Error message on invalid combination of options.
#define BUILTIN_ERR_COMBO _(L"%ls: Invalid combination of options\n")

View File

@ -113,22 +113,28 @@ echo comment after conjunction
# --help works
builtin and --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
and --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
# CHECK: 0
# CHECK: 0
builtin or --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
or --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
# CHECK: 0
# CHECK: 0
builtin not --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
not --help >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo $status
# CHECK: 0
# CHECK: 0

View File

@ -241,6 +241,7 @@ echo 7 $status # no passthrough
#CHECK: 7 4
false
set -h >/dev/null
# CHECKERR: fish: Missing man page {{.*}}
echo 8 $status # no passthrough
#CHECK: 8 0
true