Closed lorenrogers closed 8 years ago
:+1: thanks for your suggestion!
You can get the help "page" by running suspenders --help
, I don't think there is any reason to expect suspenders help
to open it as well. If we do want that, then probably moving to a rails like interface of suspenders new app_name
is a first step.
One thing we can do regardless, is showing the help "page" when we run suspenders
without any arguments as the current "No value provided for required arguments 'app_path'" is not very helpful.
What do you think?
I agree that the new
namespace would be nice. Probably a good long-term solution.
For the specific case I ran into, a short-term solution could be to have a confirmation prompt before creating the new app. E.g:
Suspenders help can be found with 'suspenders --help'
Would you like to continue creating a new app named "help"? [y,N]
Yes the help page should probably show when no arguments are passed. (Somewhat separate issue though?)
Suspenders actively avoids prompting the user, so that I'm afraid would not be a possible solution.
Anything else is up for discussion, I think. On Mon, 14 Mar 2016 at 20:57, Loren Rogers notifications@github.com wrote:
I agree that the new namespace would be nice. Probably a good long-term solution.
For the specific case I ran into, a short-term solution could be to have a confirmation prompt before creating the new app. E.g:
Suspenders help can be found with 'suspenders --help' Would you like to continue creating a new app named "help"? [y,N]
Yes the help page should probably show when no arguments are passed. (Somewhat separate issue though?)
— Reply to this email directly or view it on GitHub https://github.com/thoughtbot/suspenders/issues/730#issuecomment-196518089 .
You can get the help "page" by running
suspenders --help
, I don't think there is any reason to expectsuspenders help
to open it as well. If we do want that, then probably moving to a rails like interface ofsuspenders new app_name
is a first step.
:+1:
One thing we can do regardless, is showing the help "page" when we run suspenders without any arguments as the current "No value provided for required arguments 'app_path'" is not very helpful. What do you think?
I like this. Will appreciate @mike-burns input: is this expected command-line utility behavior?
For the specific case I ran into, a short-term solution could be to have a confirmation prompt before creating the new app.
@lorentrogers what are other utilities that have the help
option output a help page?
Doing something useful when run with no arguments seems nice. Showing --help
then might be a good idea.
Here's an example of how it was solved in https://pragprog.com/book/dccar/build-awesome-command-line-applications-in-ruby
All these produce the same help info:
rails help
rails -h
rails --help
I believe this is a documented design pattern for command line apps, but I can't seem to find the ref for it. I'll post when I come across more concrete info.
~% ls help
colorls: help: No such file or directory
~% ls -h
some-file
~% ls --help
colorls: unknown option -- -
usage: colorls [-1AaCcdFfGgHhikLlmnopqRrSsTtux] [file ...]
It may or may not be documented, but it is NOT how unix commands work. Let's instead focus on making suspenders usable. Do you need help with your pull request?
Interesting! You're 100% right that it's not a UNIX pattern -- I wouldn't expect things like cd
, ls
, or cat
to respond to a help
command. Seems like it's pretty common in ruby gems though? E.g. Bitters supports it:
bitters help
Commands:
bitters help [COMMAND] # Describe available commands or one specific command
bitters install # Install Bitters into your project
bitters remove # Remove Bitters
bitters reset # Reset Bitters
bitters version # Show Bitters version
I assume that this is because they're not documented with man
? Is there a common understanding around when the different options are used?
Long-term, we're hoping to drop the command-line aspect of suspenders -- see #676 for what we're trying to get working.
I'd rather concentrate on better output on ARGV.empty?
and on #676 than on re-arranging the arguments for the existing command. You'll want to focus on bin/suspenders
for your patch, I suspect.
Aah - makes sense. I'll put together a PR with just the ARGV.empty?
output updated.
Out of curiosity, is there a standard set of guidelines for designing ruby cli apps? I've been looking through that Copeland book -- is there a better resource for this?
Just made this mistake, expecting help. If the app is actually called "help", there should probably be a
--name
option or something.