-
Notifications
You must be signed in to change notification settings - Fork 683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add inspec env
command to configure shell tab-completion
#896
Conversation
0552e95
to
291b3f9
Compare
291b3f9
to
6f2915e
Compare
6f2915e
to
67d01be
Compare
67d01be
to
61e2c7f
Compare
|
||
def detect | ||
# Most of our detection code assumes a unix-like environment | ||
return nil if (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May it make sense to output a warning? Otherwise the user may be confused that nothing has been executed?
@stevendanna great work. Bash completion works like a charm. I've some troubles with zsh and get the following errors:
My generated content is available here: https://gist.github.com/chris-rock/a30592b0b82d13136772c10162dc5752 |
if @detected | ||
$stderr.puts '# Unable to automatically detect shell and no shell was provided.' | ||
end | ||
$stderr.puts <<EOF |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool!
Awesome implementation @stevendanna LGTM once the zsh is working |
@chris-rock I think ZSH should be working now. The issue was we weren't escaping the description text and you had plugins that had commands with |
@stevendanna works like a charm now! |
30eb05a
to
3f35f6b
Compare
inspec env
command to configure shell tab-completioninspec env
command to configure shell tab-completion
This adds a new subcommand: inspec env [SHELL] which outputs a shell-appropriate completion script that the user can source into their shell: eval "$(inspec env SHELL)" Currently, we provide completions for ZSH and Bash. The completion scripts are generated from the data Thor collects. If the user doesn't provide SHELL we attempt to detect what the user's shell may be using a number of methods. Signed-off-by: Steven Danna <steve@chef.io>
3f35f6b
to
afddeba
Compare
Merging this despite failing tests since TravisCI seems to be having an incident of some sort. |
This adds a new subcommand:
which outputs a shell-appropriate completion script that the user can
source into their shell:
Currently, we provide completions for ZSH and Bash. The completion
scripts are generated from the data Thor collects.
If the user doesn't provide SHELL we attempt to detect what the user's
shell may be using a number of methods.
Fixes #607
Signed-off-by: Steven Danna steve@chef.io