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

Add support for commandline arguments #1222

Closed
Tracked by #1896
jandubois opened this issue Jan 11, 2022 · 4 comments
Closed
Tracked by #1896

Add support for commandline arguments #1222

jandubois opened this issue Jan 11, 2022 · 4 comments
Assignees
Labels
kind/enhancement New feature or request
Milestone

Comments

@jandubois
Copy link
Member

jandubois commented Jan 11, 2022

Any value in settings.json should be configurable from the commandline:

# on MacOS
open -a "Rancher Desktop" --args --debug --kubernetes-version 1.21.8

# on  Windows
start "%LOCALAPPDATA%\Programs\Rancher Desktop\Rancher Desktop.exe" --debug --kubernetes-version 1.21.8

This can be implemented by simply changing the settings.yaml file before initializing the app. It would be more robust than the user editing the JSON file manually.

I think the easiest way to map settings properties to argument names would be to take them verbatim, and separate levels with a -, as I've done above: --kubernetes-version.

Aesthetically it looks weird to me to keep the uppercase (e.g. --portForwarding-includeKubernetesServices), but it would be the easiest to explain/document.

For boolean options I would like to see us use the Go convention that --debug is equivalent to --debug=true.

@jandubois
Copy link
Member Author

I've added this to the Next milestone because I want it to be considered in conjunction with #816 to have a consistent UX. Actual implementation may not happen for this milestone.

@gaktive gaktive modified the milestones: Next, Later Mar 8, 2022
This was referenced Mar 25, 2022
@ericpromislow
Copy link
Contributor

ericpromislow commented Apr 7, 2022

Regarding the weird case:

I decided not to do case-insensitive matching. It's easy to see how each preference field is spelled, and just copy it. That simplifies the code, and the story for users.

And of course +1 on the go-ish implicit true.

@ericpromislow
Copy link
Contributor

Usage

In development mode:

npm run dev -- --option1=value1 --option2 value2 --boolean-option-with-implicit-true --boolean-option-set-to-false=false ...

So the -- is needed after the dev

Running a release build:

macos:

open -a "/Applications/Rancher Desktop" --args <ARGS AS FOR NPM RUN DEV>

Windows & Linux:

./path/to/rancher-desktop-executable <ARGS AS FOR NPM RUN DEV>

Limitations

The kubernetes.WSLIntegrations setting is a dynamic object. On Linux its fields are paths to various executables. On Windows its field names are the names of any installed WSL distros that the user would like to activate. If any of these field names contain a hyphen, they cannot be set on the command-line.

@ericpromislow
Copy link
Contributor

Closed in #2025 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants