From c0ca4d3236df86eaa52282c70ee4f3a69c4e58ba Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 29 May 2019 21:47:10 +0200 Subject: [PATCH] functions/history: Read the search term if none is given Fixes #5791. --- share/functions/history.fish | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/share/functions/history.fish b/share/functions/history.fish index 26ab6b0f9..1e3110dff 100644 --- a/share/functions/history.fish +++ b/share/functions/history.fish @@ -103,25 +103,23 @@ function history --description "display or manipulate interactive command histor case delete # interactively delete history # TODO: Fix this to deal with history entries that have multiple lines. + set -l searchterm $argv if not set -q argv[1] - printf (_ "You must specify at least one search term when deleting entries\n") >&2 - return 1 + read -P"Search term: " searchterm end test -z "$search_mode" and set search_mode "--contains" if test $search_mode = "--exact" - builtin history delete $search_mode $_flag_case_sensitive $argv + builtin history delete $search_mode $_flag_case_sensitive $searchterm return end # TODO: Fix this so that requesting history entries with a timestamp works: # set -l found_items (builtin history search $search_mode $show_time -- $argv) set -l found_items - builtin history search $search_mode $_flag_case_sensitive --null -- $argv | while read -lz x - set found_items $found_items $x - end + set found_items (builtin history search $search_mode $_flag_case_sensitive --null -- $searchterm | string split0) if set -q found_items[1] set -l found_items_count (count $found_items) for i in (seq $found_items_count)