chore(cli): Add --no-open to cli options - #2643
Conversation
|
@Shinigami92 - Happy to update some types as well but I wasn't 100% sure where |
|
I think that the |
|
Ah yeah, I didn't realize that feature was a part of cac but after reading it, that totally makes sense. I'll update the documentation for the cli options to reflect this negation of boolean options. |
| .option('--port <port>', `[number] specify port`) | ||
| .option('--https', `[boolean] use TLS + HTTP/2`) | ||
| .option('--open [path]', `[boolean | string] open browser on startup`) | ||
| .option('--no-open', `[boolean] prevents browser opening on startup`) |
There was a problem hiding this comment.
So as you already found out, this is invalid due to cac provide this by default
There was a problem hiding this comment.
I unfortunately don't see an option in cac to provide any kind of global option aside text for all options. There are a couple methods like usage, example, or command description I could leverage but the output isn't the greatest and doesn't seem fit for this use case.
I could use example and show one usage of using the negation option feature of cac?
There was a problem hiding this comment.
Ah oh, so this theoretically overrides just the description text?
There was a problem hiding this comment.
Maybe this is something you could discuss in an issue or discussion in cac @drobannx , maybe they have best practices already
There was a problem hiding this comment.
Yeah, the change in this PR would only show that additional option but cac does treat the defaults differently in this case.
https://github.com/cacjs/cac#negated-options
So this change would set open to true by default but then passing --no-open as an arg would set the value to false
There was a problem hiding this comment.
I think you got it yourself, but just want to mention it: changing the default value is not an option
The default have to be false in this case
There was a problem hiding this comment.
@matias-capeletto - I'll go ahead and close this PR and see if there is some discussion over in cac about this. Thank you and @Shinigami92 for your time in helping with this, I appreciate it!
There was a problem hiding this comment.
Looks like there already is an open PR over there for this very issue: cacjs/cac#104
Before submitting the PR, please make sure you do the following
fixes #123).What is the purpose of this pull request?
Description
This PR updates the cli options output to add the
--no-openoption that will prevent the browser from opening on startup.