Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow "attach" and "down" subcommands to work, show it in ponysay example #82
allow "attach" and "down" subcommands to work, show it in ponysay example #82
Changes from 2 commits
1c6fa84
4e42448
c0fb6ab
58d976e
25804f1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see what purpose
[[ "$1" == -* ]]
serves here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to explain it in the comments, but it looks like it failed 😅
If the first argument starts with a dash, we know it's no subcommand. And if the first argument is no subcommand, we assume there is no subcommand argument at all. And if there is none, process-compose defaults to the up command. And therefore it's allowed to pass arguments dedicated to the up command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understood the what, but I'm asking why.
This is of course wrong, since
--help
is not equivalent toup
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems to be one of the edge cases I mentioned. Properly dealing with it could be tricky, though. Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not remove
[[ "$1" == -* ]]
entirely?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the
"$1" == "up"
case, shouldn't you drop theup
from$@
? Otherwise, in line 60 it will be passed twice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, we're passing the arguments on as we receive them, and we never add an "up" ourselves afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right:
But then, I just noticed something new here. Note that
--disable-dotenv --theme Cobalt
(defined incli.up
) appears before theup
argument. It looks like their CLI parser accepts this out of order arguments anyway. But for clarity, I'd prefer that--disable-dotenv --theme Cobalt
appear after theup
argument, because those options are meant forup
subcommand anyway.Suppressing incorrect observation
Wait, I was wrong. Actually those are global options! We should fix this in options.--sort
however is anis another example:up
specific option, so that's a better illustrationWithout arguments, we see:
(And I'd still like to make
up
implicit here)With
up
argument:Here, I think
--sort health
should appear afterup
to make it clear (to the user who happens to diagnose our script output) that these flags are forup
command only.This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, it's better to put user arguments first. I've changed that.