summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZack Hobson2013-11-20 08:34:37 -0800
committerZack Hobson2013-11-20 08:34:37 -0800
commit9b962a50218cac283c9b8075d238b391f6555fad (patch)
tree04db51bdb3502e976dcacfda381395368e6fc6bd
parentb35ffaad3a9b75e275464aa3c1a2fd4434673125 (diff)
downloadhcl-9b962a50218cac283c9b8075d238b391f6555fad.tar.bz2
completion: output a bash completion script
-rw-r--r--CHANGELOG4
-rw-r--r--README.markdown6
-rw-r--r--lib/hcl/commands.rb4
3 files changed, 14 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3ccc2ca..93a4903 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,9 @@
= Recent Changes in HCl
+== v0.4.4
+
+* added completion command to output a Bash completion script
+
== v0.4.3
* added cancel command to delete the last running timer, closes #13
diff --git a/README.markdown b/README.markdown
index 67fbaf1..959d6b9 100644
--- a/README.markdown
+++ b/README.markdown
@@ -96,6 +96,12 @@ the same arguments as start:
The above starts and immediately stops a one-hour timer with the given note.
+### Bash Auto-completion of Task Aliases
+
+You can enable auto-completion of task aliases by adding this to your bashrc:
+
+ eval `hcl completion`
+
### Date Formats
Dates can be expressed in a variety of ways. See the [Chronic documentation][cd]
diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb
index 250ec0e..254138e 100644
--- a/lib/hcl/commands.rb
+++ b/lib/hcl/commands.rb
@@ -62,6 +62,10 @@ module HCl
end
end
+ def completion
+ %[complete -W "#{aliases.join ' '}" hcl]
+ end
+
def aliases
@settings.keys.select { |s| s =~ /^task\./ }.map { |s| "@"+s.slice(5..-1) }
end