diff --git a/share/functions/history.fish b/share/functions/history.fish index fecb9fec3..011bbc87f 100644 --- a/share/functions/history.fish +++ b/share/functions/history.fish @@ -176,28 +176,38 @@ function history --description "display or manipulate interactive command histor end case save # save our interactive command history to the persistent history - builtin history save -- $argv + builtin history save $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv case merge # merge the persistent interactive command history with our history - builtin history merge -- $argv + builtin history merge $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv case clear # clear the interactive command history + if test -n "$search_mode" + or set -q show_time[1] + printf (_ "%ls: %ls: subcommand takes no options\n") history $hist_cmd >&2 + return 1 + end + if set -q argv[1] + printf (_ "%ls: %ls: expected %d arguments; got %d\n") history $hist_cmd 0 (count $argv) >&2 + return 1 + end + printf (_ "If you enter 'yes' your entire interactive command history will be erased\n") read --local --prompt "echo 'Are you sure you want to clear history? (yes/no) '" choice if test "$choice" = yes - builtin history clear -- $argv + builtin history clear $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv and printf (_ "Command history cleared!\n") else printf (_ "You did not say 'yes' so I will not clear your command history\n") end case clear-session # clears only session - builtin history clear-session -- $argv - printf (_ "Command history for session cleared!\n") + builtin history clear-session $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $argv + and printf (_ "Command history for session cleared!\n") case append set -l newitem $argv if not set -q argv[1] read -P "Command: " newitem end - builtin history append -- $newitem + builtin history append $search_mode $show_time $max_count $_flag_case_sensitive $_flag_reverse $_flag_null -- $newitem case '*' printf "%ls: unexpected subcommand '%ls'\n" $cmd $hist_cmd return 2