[chef] Re: Re: Re: Knife bash completion - improved


Chronological Thread 
  • From: Jacobo García < >
  • To:
  • Subject: [chef] Re: Re: Re: Knife bash completion - improved
  • Date: Thu, 20 Jan 2011 16:46:57 +0100
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=Z0xI02F7Y3yog++Dj0p0YEwcamHSqt8BTJNg0hZNqnq+nI8IyKkVoCtZxunudgIGvk ZGpiBcjG1+yIFfDJxFiGsBjRwWuF7qjjoeTTi9M2GpJiE1McfWy5f8eIjWre1DTrLxDF fUtzCEfgZI1WEEmyvAHw0v+nldaPq12NtB4UI=

Hello,

Thanks for your script, it's great, specially for beginers on the chef CLI.

I tried your script in OS X too and the problems are related to differences between GNU sed and BSD sed. I just quick fixed them installing gsed with macports and changing sed references to gsed.

Also it's possible to have a knife config file per chef repository instead of ~/.chef/knife.rb. This way you can work over several chef servers. I am not sure how to fix that in the script but probably there's some clues on knife code. I found the script crashing here too.

Greetings.

Jacobo García López de Araujo
blog: http://robotplaysguitar.com
http://workingwithrails.com/person/13395-jacobo-garc-a



On Thu, Jan 20, 2011 at 3:40 PM, Avishai Ish-Shalom < "> > wrote:
Well, my wife has a mac. I'll try to arm wrestle her for some quality
time with it later today.

Regards,
Avishai


On 01/20/2011 04:36 PM, Jacob Vanderdray wrote:
>       This sounded helpful enough that I gave it a shot.  I'm using a Mac, so I ran into a few issues.  Unfortunately I still don't have it working past the first knife parameter (i.e. if I type "knife cook" and hit <tab> I end up with "knife cookbook", but when I type "knife cookbook upl" and hit tab I get an error.  I'm going to give up for now, but if you're interested here's what I had to do (This is mostly from memory so YMMV):
>
> Use Macports to install bash-completion:
>  sudo port install bash-completion
>
> Update ~/.bash_profile with:
>
> # MacPorts Bash shell command completion
> if [ -f /opt/local/etc/bash_completion ]; then
>    . /opt/local/etc/bash_completion
> fi
>
> The version of sed used in this script uses "-r" to get extended regular expressions, but for the version of sed on my Mac I had to change that to "-E".  If someone works out the rest, I'd be interested.
>
> Thanks,
> Jake.
>
> On Jan 20, 2011, at 4:06 AM, Avishai Ish-Shalom wrote:
>
>> OK. Now it works fast, used cache files for command completions and
>> while i was at it i added roles and nodes completion.
>>
>> Cache files reside in $CHEF_HOME/.completion_cache and you have to
>> create this directory if you want cached completion.
>>
>>
>> And yes, now it will read chef repository locations from either
>> CHEF_REPOS or $CHEF_HOME/knife.rb
>>
>>
>> enjoy.
>>
>> Avishai
>>
>> <knife.txt>




Archive powered by MHonArc 2.6.16.

§