18F / Sendak

[DEPRECATED] Sendak integrates user, project, and deployment management for 18F
Other
10 stars 4 forks source link

Tab completion for sendak commands #65

Open konklone opened 9 years ago

konklone commented 9 years ago

For someone, somewhere: I have no idea how custom bash tab completion works, but I know it's a life saver for git and gpg and all sorts of things. It would help sendak too.

janearc commented 9 years ago

Two things. First of all, since the halp syntax is regular across all of sendak (because of sendak-usage), it should be really easy to parse the output for what each task is "capable" of doing (sendak task --help | cut -d' ' -f 1); bash tab completion (or, bourne-shell, really, because zsh does the same thing) just executes commands after tab whacks. You define those commands somewhere in a hints file.

Anyways, so yeah it should not be hard because both --list-tasks is regular and the --help is regular for all the tasks. But the other thing to add is that I've been toying with this idea of shell-pluggable which would make this really easy to do, and would be portable to anything we (we 18F, we Jane, we The People, etc) wanted to subsequently do and have tab completion for.

konklone commented 9 years ago

I don't breathe shell well enough to be super comfortable with cut, sadly. -_- I'd definitely benefit from tab completion.

I'm not totally done wrapping my head around shell-pluggable, but I think I get the basic idea - a framework for plugging in subcommands to a central command. Seems like it'd also involve making a meta-format for the bash hints file, that shell-pluggable compiles to...? Or shell-pluggable would just demand that pluggable sets of commands put it at some predictable location in their repo...?