rackspace / rack

A CLI for Rackspace (unmaintained)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make init's features available separately

lvh opened this issue · comments

commented

rack init combines man page installation and bash configuration. It'd be nice if these features were available separately. I don't use bash, so I got the following error:

lvh@zygalski /u/l/L/Formula (rack)> rack init                                                                                                                                                                                                                           10:54:10
Looking for .bash_profile in /Users/lvh/.bash_profile
/Users/lvh/.bash_profile doesn't exist. You should create it and/or install your operating system's `bash_completion` package.⏎

After this, no attempt is made to install the man page. I'm using fish, so just installing the man page would have given me working autocompletion.

I think a useful 80% first approximation would be to just make the features available separately, and continue letting rack init try to do both. As a super fancy polish gold-plated feature, it might be a good idea to make init be smart about checking for which shell you're running, and e.g. print a warning for zsh, just do the current completion thing for bash, and do nothing for fish (since it's smart enough to extract completion from the man page).

What about maybe making both available through flags on rack init?

For example, to do only the man page: rack init --man-page, or to only enable tab completion, rack init --tab-completion

This might be a duplicate: #368 . I'll leave it up to you @lvh

commented

Yeah, I'm -0 on exposing those as separate top-level commands, or creating "hidden" top-level commands. I think it's a little weird that rack init --man-page would do less than rack init, but I definitely don't want to contribute to any arguments about the color of the bikeshed beyond suggesting --no-bash-completion instead, and then absconding while cackling manically.

commented

Whoops, you're absolutely right re: this being a duplicate. Would you like me to copy any information from this ticket?

Yes please :)

It does appear to be a duplicate of #368. I agree that perhaps it should be the inverse of what I proposed; you're correct about hoping to not add more top-level commands.

You mean like:

# rack init
=
# rack init man
# rack init completion

?

commented

@StephenBrown2 That looks even better. I've copied your suggestion on the new ticket; I guess we'll close this :)