diff options
| author | Zack Hobson | 2014-01-26 09:57:08 -0800 | 
|---|---|---|
| committer | Zack Hobson | 2014-01-26 09:57:08 -0800 | 
| commit | 8c39b363ca5fc3f38772ad579f1145a72a97a1b4 (patch) | |
| tree | 31c123bc8c649ace1f52bc6cb020fdd6ba87407d | |
| parent | 5498488f77446fd79bea7b43f24f6b4c20d507ef (diff) | |
| download | hcl-8c39b363ca5fc3f38772ad579f1145a72a97a1b4.tar.bz2 | |
deprecate completion command, closes #51
| -rw-r--r-- | CHANGELOG.markdown | 1 | ||||
| -rw-r--r-- | Gemfile.lock | 2 | ||||
| -rw-r--r-- | README.markdown | 4 | ||||
| -rw-r--r-- | lib/hcl/app.rb | 4 | ||||
| -rw-r--r-- | lib/hcl/commands.rb | 3 | ||||
| -rw-r--r-- | lib/hcl/version.rb | 2 | ||||
| -rw-r--r-- | man/hcl.1.ronn | 4 | 
7 files changed, 14 insertions, 6 deletions
| diff --git a/CHANGELOG.markdown b/CHANGELOG.markdown index fa38f1b..6ce93d2 100644 --- a/CHANGELOG.markdown +++ b/CHANGELOG.markdown @@ -3,6 +3,7 @@  ## latest  * add --changelog option +* remove completion command, cache aliases in a file instead, closes #51  ## v0.4.11 2014-01-25 diff --git a/Gemfile.lock b/Gemfile.lock index cfd0775..614f8ed 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@  PATH    remote: .    specs: -    hcl (0.4.11) +    hcl (0.4.12)        chronic (~> 0.10.2)        escape_utils (~> 1.0.1)        faraday (~> 0.9.0) diff --git a/README.markdown b/README.markdown index 7b3b1da..62859ed 100644 --- a/README.markdown +++ b/README.markdown @@ -118,7 +118,7 @@ The above starts and immediately stops a one-hour timer with the given note.  You can enable auto-completion of task aliases by adding this to your shell  configuration: -    eval `hcl completion` +    complete -W `cat ~/.hcl/aliases` hcl  ### Configuration Profiles @@ -132,7 +132,7 @@ Here is a shell alias `myhcl` with a separate configuration from the  main `hcl` command, and another command to configure alias completion:      alias myhcl="env HCL_DIR=~/.myhcl hcl" -    eval `myhcl completion myhcl` +    complete -W `cat ~/.myhcl/aliases` myhcl  Adding something like the above to your bashrc will enable a new command,  `myhcl`. When using `myhcl` you can use different credentials and aliases, diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb index 1ddc805..044b83d 100644 --- a/lib/hcl/app.rb +++ b/lib/hcl/app.rb @@ -11,6 +11,7 @@ module HCl      HCL_DIR = (ENV['HCL_DIR'] || "#{ENV['HOME']}/.hcl").freeze      SETTINGS_FILE = "#{HCL_DIR}/settings.yml".freeze +    ALIAS_LIST = "#{HCL_DIR}/aliases".freeze      CONFIG_FILE = "#{HCL_DIR}/config.yml".freeze      attr_reader :http @@ -187,6 +188,9 @@ EOM      end      def write_settings +      File.open(ALIAS_LIST, 'w') do |f| +        f.write aliases.join(' ') +      end        File.open(SETTINGS_FILE, 'w') do |f|         f.write @settings.to_yaml        end diff --git a/lib/hcl/commands.rb b/lib/hcl/commands.rb index 784f343..c753fbf 100644 --- a/lib/hcl/commands.rb +++ b/lib/hcl/commands.rb @@ -79,6 +79,9 @@ module HCl      def completion command=nil        command ||= $PROGRAM_NAME.split('/').last +      $stderr.puts \ +        "The hcl completion command is deprecated (and slow!), instead use something like:", +        "> complete -W `cat #{HCl::App::ALIAS_LIST}` #{command}"        %[complete -W "#{aliases.join ' '}" #{command}]      end diff --git a/lib/hcl/version.rb b/lib/hcl/version.rb index ee35062..f62a0b6 100644 --- a/lib/hcl/version.rb +++ b/lib/hcl/version.rb @@ -1,3 +1,3 @@  module HCl -  VERSION = '0.4.11' +  VERSION = '0.4.12'  end diff --git a/man/hcl.1.ronn b/man/hcl.1.ronn index 52ebd9d..c40bfcb 100644 --- a/man/hcl.1.ronn +++ b/man/hcl.1.ronn @@ -102,7 +102,7 @@ The above starts and immediately stops a one-hour timer with the given note.  You can enable auto-completion of task aliases by adding this to your shell  configuration: -    eval `hcl completion` +    complete -W `cat ~/.hcl/aliases` hcl  ### Configuration Profiles @@ -116,7 +116,7 @@ Here is a shell alias `myhcl` with a separate configuration from the  main `hcl` command, and another command to configure alias completion:      alias myhcl="env HCL_DIR=~/.myhcl hcl" -    eval `myhcl completion myhcl` +    complete -W `cat ~/.myhcl/aliases` myhcl  Adding something like the above to your bashrc will enable a new command,  `myhcl`. When using `myhcl` you can use different credentials and aliases, | 
