Skip to content
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

feat: add app.commandLine.hasSwitch() / app.commandLine.getSwitchValue() #16282

Merged
merged 5 commits into from Jan 7, 2019

Conversation

miniak
Copy link
Contributor

@miniak miniak commented Jan 4, 2019

Description of Change

Expose the following APIs, which we are already using internally in lib/renderer/init.js

  • app.commandLine.hasSwitch()
  • app.commandLine.getSwitchValue()

These methods are useful for parsing command-line options in robust way without having to use external libraries.

Checklist

Release Notes

Notes: Added app.commandLine.hasSwitch() / app.commandLine.getSwitchValue()

Copy link
Member

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

lib/browser/api/app.js Outdated Show resolved Hide resolved

Returns `String` - The command-line switch value.

**Note:** When the switch is not present, it returns empty string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's how the chromium API behaves

lib/browser/api/app.js Outdated Show resolved Hide resolved
Copy link
Contributor

@alexeykuzmin alexeykuzmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See a minor question above.

Copy link
Member

@ppontes ppontes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codebytere codebytere merged commit 6f117b8 into master Jan 7, 2019
@release-clerk
Copy link

release-clerk bot commented Jan 7, 2019

Release Notes Persisted

Added app.commandLine.hasSwitch() / app.commandLine.getSwitchValue()

@codebytere codebytere deleted the miniak/commandline-api branch January 7, 2019 15:48
akisctx pushed a commit to akisctx/electron that referenced this pull request Jan 22, 2019
…e() (electron#16282)

* feat: add app.commandLine.hasSwitch() / app.commandLine.getSwitchValue()

* add more tests

* refactor: move appendSwitch / appendArgument to command_line module

* replace AppendSwitchASCII with AppendSwitchNative

* remove castArgs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants