Knife bash completion

Attached is a bash completion script for knife. 1st level command
completion is fast (and hardcoded), nth level is read from knife sub command --help so it’s a little slow.

If anyone feels like adding feature, please do.


Regards,
Avishai Ish-Shalom

You Rock!

Thanks a lot

On Wed, Jan 19, 2011 at 8:41 AM, Avishai Ish-Shalom
avishai@fewbytes.com wrote:

Attached is a bash completion script for knife. 1st level command
completion is fast (and hardcoded), nth level is read from knife sub command --help so it's a little slow.

If anyone feels like adding feature, please do.

--
Regards,
Avishai Ish-Shalom

Thanks.

One thing I forgot to mention is the CHEF_REPOS variable. If you want
completion for your cookbooks on the knife cookbook upload command set
this variable as an array pointing to your chef cookbook directories
like so:

export CHEF_REPOS=( /home/avishai/chef-repo/site-cookbooks
/home/avishai/chef-repo/cookbooks )

Regards,
Avishai

On 01/19/2011 07:22 PM, Gilles Devaux wrote:

You Rock!

Thanks a lot

On Wed, Jan 19, 2011 at 8:41 AM, Avishai Ish-Shalom
avishai@fewbytes.com wrote:

Attached is a bash completion script for knife. 1st level command
completion is fast (and hardcoded), nth level is read from knife sub command --help so it's a little slow.

If anyone feels like adding feature, please do.

--
Regards,
Avishai Ish-Shalom

You could read the cookbooks path from the users knife.rb:

Chef::Knife.new.configure_chef
CHEF_REPOS = Chef::Config[:cookbook_path]

On Wed, Jan 19, 2011 at 12:47 PM, Avishai Ish-Shalom
avishai@fewbytes.com wrote:

Thanks.

One thing I forgot to mention is the CHEF_REPOS variable. If you want
completion for your cookbooks on the knife cookbook upload command set
this variable as an array pointing to your chef cookbook directories
like so:

export CHEF_REPOS=( /home/avishai/chef-repo/site-cookbooks
/home/avishai/chef-repo/cookbooks )

Regards,
Avishai

On 01/19/2011 07:22 PM, Gilles Devaux wrote:

You Rock!

Thanks a lot

On Wed, Jan 19, 2011 at 8:41 AM, Avishai Ish-Shalom
avishai@fewbytes.com wrote:

Attached is a bash completion script for knife. 1st level command
completion is fast (and hardcoded), nth level is read from knife sub command --help so it's a little slow.

If anyone feels like adding feature, please do.

--
Regards,
Avishai Ish-Shalom