Issue #9477 has been updated by Matt Robinson. Assignee set to Matt Robinson Branch set to https://github.com/mmrobins/puppet/tree/ticket/2.7.x/bash_completion
I've wanted this for a long time so I whipped up a quick prototype to see how hard it would be - it's in the attached branch. It works pretty well. It's a bit of ruby code that shells out to compgen to generate stuff that `complete -C` can work with. The code definitely needs some cleanup before this could ever be merged. One problem I have is that the completion is kinda slow, sometimes taking over a second after you press tab to get the completion list back. I'm guessing that requiring puppet is doing a lot more work than is necessary to list the faces, legacy apps and options. A couple of solutions to that: * rather than generate the completion lists on the fly for every tab press prebuild the options into the completion script. This would certainly be faster, but would me you'd have to rebuild your completion script whenever you added a face or option. I'm also not sure of how to make bash's completion system do some of the logic I want to know which options to print depending on subcommand - I'm sure it's not that hard, it's just easier in Ruby and I'm not sure if there's built in functions that would make this easier or if I just have to write a lot of bash case statements. * speed up puppet on first require - I'd rather do this and will look into how hard this is. I'm also not 100% sure yet how to handle the completion of options from defaults.rb. Which options should be used will depend on the run_mode of the subcommand chosen, and I'm not sure how to introspect that out of either faces or legacy apps. Until I can do that, doing completion from the default run_mode of user should be better than nothing. I'll be continuing to work on this as I have time, but if anyone has suggestions, or better yet wants to try it out and give me feedback, that's most welcome. I'll demo this next week too. ---------------------------------------- Feature #9477: Bash completion script for puppet faces/legacy subcommands https://projects.puppetlabs.com/issues/9477 Author: Nick Fagerlund Status: Accepted Priority: Normal Assignee: Matt Robinson Category: Faces Target version: Affected Puppet version: Keywords: Branch: https://github.com/mmrobins/puppet/tree/ticket/2.7.x/bash_completion The widely available bash completion scripts for Git will complete subcommands for you, even if they're custom aliases. We should do that, and detect all the custom faces (and older applications) available! -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
