-
Notifications
You must be signed in to change notification settings - Fork 712
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
scope launch script improvements #2077
Conversation
565f499
to
82270b0
Compare
This fixes #2073, right? And perhaps some others? |
yes, sorry. I edited to mention that between you loading and you commenting. |
Slightly changed the wording to properly fix #1556 |
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.
Looks great, thanks!
I think there are a couple of open tickets in Scope that this might fix. Would you mind taking a quick look & linking them before merging? Best effort is fine.
# TODO: properly escape/quote the output of "$@" | ||
echo $(launch_command) "$@" | ||
# Most systems should have printf, but the %q specifier isn't mandated by posix | ||
# and can't be guarenteed. Since this is mainly a cosmetic output and the alternative |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
By far the majority of these were variables which were not quoted. While, yes, right now we can guarentee most of these variables will never contain spaces, this could someday change and applying quoting as a universal rule prevents future mistakes. The ARGS="$@" -> "$*" change is purely stylistic and mainly is used to indicate the intent that we actually wanted to concatenate all the args by spaces, not keep them seperated as "$@" would in many situations, but not this one. Several warnings remain, in places where we intentionally want to split a variable on whitespace, or otherwise do what shellcheck is warning us against. Of note is shellcheck warning SC2166, which says to prefer [ foo ] || [ bar ] over [ foo -o bar ] as the -a and -o flags have differing behaviour on some systems. I've opted to keep these for now, since the version check test command would need to be replaced by a LOT of subshells to achieve the same effect, which feels dirtier.
As indicated by the TODO, any args passed into the command do not get escaped when output, so for example: scope command "foo bar" would output results like: foo bar instead of "foo bar" or foo\ bar The "right" way to do this seems to be printf %q, which prints a quoted version of the string. However this format specifier is not available in POSIX sh (though it does work in many implementations of it, such as the ones provided by bash which make up the likely majority of real-world usage). This code is a compromise that uses the added functionality where available, while still falling back to the old behaviour when it isn't.
Instead of different usage info for "scope help", show the same always. Also correct it for what the script actually does, and always display the scope binary args.
It's not useful and it's confusing. Replaced with a generic "it worked" message.
… worked We can't easily do this since scope exits failure when -h is passed, so we can't distinugish between success and failure.
17e83ff
to
2562567
Compare
scope command
when availableSee individual commits for discussion on each point.
Fixes #2073. Fixes #1556. Fixes #1557. Fixes #1560.