aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/history.fish
diff options
context:
space:
mode:
authorGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-06-06 20:51:37 +0530
committerGravatar Siteshwar Vashisht <siteshwar@gmail.com>2012-06-06 20:54:27 +0530
commit1078ad9ae93f38eb3cb7d841633cc9b6a6a33459 (patch)
treea3e506ec2c80f4c35ad0a8a15a2984a16fdbd8e9 /share/functions/history.fish
parentc0085cbc6191f667a7ad7b6ed1510bbe3bedc1e4 (diff)
Fixed following bugs in history function:
1. history function without any argument now correctly shows user's command history. 2. history --save now saves user's command history.
Diffstat (limited to 'share/functions/history.fish')
-rw-r--r--share/functions/history.fish27
1 files changed, 15 insertions, 12 deletions
diff --git a/share/functions/history.fish b/share/functions/history.fish
index f313d0d2..b71931c0 100644
--- a/share/functions/history.fish
+++ b/share/functions/history.fish
@@ -23,13 +23,18 @@ function history --description "Deletes an item from history"
case --contains
set search_mode contains
set contains_args $argv[(math $i + 1)]
+ case --save
+ set cmd save
case --clear
set cmd clear
case --search
set cmd print
-
end
end
+ else
+ #Execute history builtin without any argument
+ builtin history
+ return
end
switch $cmd
@@ -99,18 +104,16 @@ function history --description "Deletes an item from history"
end
end
end
-
+ case save
+ #Save changes to history file
+ builtin history $argv
case clear
# Erase the entire history
- if test $clear = 1
- echo "Are you sure you want to clear history ? (y/n)"
- read ch
- if test $ch = "y"
- builtin history $argv
- echo "History cleared!"
- end
- else
- builtin history $argv
- end
+ echo "Are you sure you want to clear history ? (y/n)"
+ read ch
+ if test $ch = "y"
+ builtin history $argv
+ echo "History cleared!"
+ end
end
end