aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-07-21 22:17:46 -0400
committerTeddy Wing2016-07-21 22:17:46 -0400
commit48993ad34d2976f963f05ed9eaeed736b9668004 (patch)
tree1ca6ea81ffa141ce04024ed06f9fc662e0cd3353
parent8f564b8615336e15d5ffb01ee0bc8622a32e8031 (diff)
downloadqcd-48993ad34d2976f963f05ed9eaeed736b9668004.tar.bz2
qcd: Add "remove" command
Remove a given shortcut from the database.
-rwxr-xr-xqcd9
1 files changed, 9 insertions, 0 deletions
diff --git a/qcd b/qcd
index 07a653b..6a5b838 100755
--- a/qcd
+++ b/qcd
@@ -55,6 +55,14 @@ function change_shortcut () {
fi
}
+function remove_shortcut () {
+ local shortcut=$1
+
+ if shortcut_exists $shortcut; then
+ sed -i.bak -E "/^${shortcut} .+/d" $QCD_DATABASE_FILE
+ fi
+}
+
function qcd () {
if [[ $# < 1 ]]; then
print_usage
@@ -75,6 +83,7 @@ function qcd () {
change_shortcut $shortcut $path
;;
-r)
+ remove_shortcut $shortcut
;;
-h|--help)
print_usage