-
Notifications
You must be signed in to change notification settings - Fork 683
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
Open local address in default browser #198
Conversation
👍 I'd rather call it |
Yeah 😀. It should be |
@leo I have changed |
lib/listening.js
Outdated
@@ -67,6 +68,13 @@ module.exports = coroutine(function*(server, current, inUse, clipboard) { | |||
} catch (err) {} | |||
} | |||
|
|||
if(open) { |
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.
Please add a space before the (
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.
Also please test for isTTY
lib/listening.js
Outdated
if(open) { | ||
try { | ||
opn(localURL) | ||
message += `\n\n${chalk.grey('Local address has opened in browser!')}` |
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.
Let's not show any additional messages in the terminal!
bin/serve.js
Outdated
@@ -108,7 +109,7 @@ detect(port).then(open => { | |||
server.listen( | |||
port, | |||
coroutine(function*() { | |||
yield listening(server, current, inUse, flags.noClipboard !== true) | |||
yield listening(server, current, inUse, flags.noClipboard !== true, flags.open === true) |
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 the comparison? flags.open
should be enough
@leo Updated all the changes you asked. |
bin/serve.js
Outdated
@@ -50,7 +50,7 @@ args | |||
) | |||
.option('silent', `Don't log anything to the console`) | |||
.option('no-clipboard', `Don't copy address to clipboard`, false) | |||
|
|||
.option('open', `Open local address in browser`, false) |
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.
Use ' instead of ` here, please
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.
should I change it for silent and no-clipboard also?
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.
@webtaculars No, because they have a ' in the value.
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.
we can escape it using backslash
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, but prettier might revert that. Try it!
Thanks! ✌️ |
Open local address in default browser by using option --local.
serve --local
EDIT
Command is now
serve --open