mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-26 07:41:15 -03:00
functions/man: use "command man", skipping functions
As reported in
https://github.com/fish-shell/fish-shell/issues/11767#issuecomment-3240198608,
the new "man" function uses "rm" which is sometimes overidden to do
"rm -i".
Same as d3dd9400e3 (Make sure the rm command and not a wrapper
function that could change its behaviour is used. 2006-12-12)
While at it, make sure that all users of __fish_mktemp_relative
1. return if mktemp fails
2. actually clean up their temporary directory -- except for help.fish
which spawns an asynchronous browser window.
This commit is contained in:
@@ -21,12 +21,14 @@ function fish_config --description "Launch fish's web based configuration"
|
||||
and set __fish_bin_dir (path dirname -- $fish_path)
|
||||
if set -l python (__fish_anypython)
|
||||
set -l mainfile $__fish_data_dir/tools/web_config/webconfig.py
|
||||
set -l temp
|
||||
if not path is -- $mainfile
|
||||
if not status list-files tools/web_config &>/dev/null
|
||||
echo "Cannot find web configuration tool. Please check your fish installation."
|
||||
return 1
|
||||
end
|
||||
set -l temp (__fish_mktemp_relative -d fish_config)
|
||||
set temp (__fish_mktemp_relative -d fish_config)
|
||||
or return
|
||||
for dir in (status list-files tools/web_config | path dirname | path sort -u)
|
||||
mkdir -p $temp/$dir
|
||||
or return
|
||||
@@ -39,9 +41,14 @@ function fish_config --description "Launch fish's web based configuration"
|
||||
end
|
||||
|
||||
$python "$mainfile" $argv
|
||||
set -l saved_status $status
|
||||
|
||||
if set -q temp[1]
|
||||
command rm -r $temp
|
||||
end
|
||||
|
||||
# If the execution of 'webconfig.py' fails, display python location and return.
|
||||
if test $status -ne 0
|
||||
if test $saved_status -ne 0
|
||||
echo "Please check if Python has been installed successfully."
|
||||
echo "You can find the location of Python by executing the 'command -s $python' command."
|
||||
return 1
|
||||
|
||||
@@ -6,12 +6,14 @@ function fish_update_completions --description "Update man-page based completion
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l temp
|
||||
if not test -e "$script"
|
||||
if not status list-files tools/create_manpage_completions.py &>/dev/null
|
||||
echo "Cannot find man page completion generator. Please check your fish installation."
|
||||
return 1
|
||||
end
|
||||
set -l temp (__fish_mktemp_relative -d fish_update_completions)
|
||||
set temp (__fish_mktemp_relative -d fish_update_completions)
|
||||
or return
|
||||
for file in create_manpage_completions.py deroff.py
|
||||
status get-file tools/$file >$temp/$file
|
||||
or return
|
||||
@@ -23,4 +25,11 @@ function fish_update_completions --description "Update man-page based completion
|
||||
# display progress.
|
||||
set -l update_args -B $script --manpath --cleanup-in $__fish_user_data_dir/generated_completions --cleanup-in $__fish_cache_dir/generated_completions --progress $argv
|
||||
$python $update_args
|
||||
set -l saved_status $status
|
||||
|
||||
if set -q temp[1]
|
||||
command rm -r $temp
|
||||
end
|
||||
|
||||
return $saved_status
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ function funcsave --description "Save the current definition of all specified fu
|
||||
functions --no-details -- $funcname >$funcpath
|
||||
and set -q _flag_quiet || printf (_ "%s: wrote %s\n") funcsave $funcpath
|
||||
else if test -w $funcpath
|
||||
rm $funcpath
|
||||
command rm $funcpath
|
||||
and set -q _flag_quiet || printf (_ "%s: removed %s\n") funcsave $funcpath
|
||||
else
|
||||
printf (_ "%s: Unknown function '%s'\n") funcsave $funcname >&2
|
||||
|
||||
@@ -58,6 +58,7 @@ function man --description "Format and display the on-line manual pages"
|
||||
set -l tmpdir
|
||||
if not set -q argv[2] && status list-files "man/man1/$argv[1].1" &>/dev/null
|
||||
set tmpdir (__fish_mktemp_relative -d fish-man)
|
||||
or return
|
||||
status get-file "man/man1/$argv[1].1" >$tmpdir/$argv.1
|
||||
set argv $tmpdir/$argv.1
|
||||
end
|
||||
@@ -66,7 +67,7 @@ function man --description "Format and display the on-line manual pages"
|
||||
set -l saved_status $status
|
||||
|
||||
if set -q tmpdir[1]
|
||||
rm -r $tmpdir
|
||||
command rm -r $tmpdir
|
||||
end
|
||||
|
||||
return $saved_status
|
||||
|
||||
Reference in New Issue
Block a user