Skip to content

CLI: Add --version to CLI option #7549

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

Merged
merged 3 commits into from
May 22, 2018
Merged

CLI: Add --version to CLI option #7549

merged 3 commits into from
May 22, 2018

Conversation

yohsuke
Copy link
Contributor

@yohsuke yohsuke commented May 2, 2018

I added to get the Arduino IDE version from the command line
It will allow to check easily if the new Arduino is already installed.

This feature makes it easier to build external systems linked to specific versions of Arduino.

  1. I added --version action, which shows version name and exit
    1. Currently, VERSION_NAME_LONG (like 1.8.5, 1.9.0-beta, 1.8.6 Hourly Build XXX, etc...) is used. Because I want to know its version number and stable/beta/hourly.
    2. Finish with 0. Because it is SUCCESSFLLY FINISHED.
  2. Updated man page.

I added to get the Arduino IDE version from the command line
It will allow to check easily if the new Arduino is already installed.

This feature makes it easier to build external systems linked to specific versions of Arduino.

1. I added `--version` action, which shows version name and exit
  1. Currently, VERSION_NAME_LONG (like `1.8.5`, `1.9.0-beta`, `1.8.6 Hourly Build XXX`, etc...) is used. Because I want to know its version number and stable/beta/hourly.
  2. Finish with `0`. Because it is `SUCCESSFLLY FINISHED`.
2. Updated man page.
Copy link
Collaborator

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

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

Adding --version sounds like a good idea, but I left one comment about where to implement it.

@@ -84,6 +85,10 @@ public void parseArgumentsPhase1() {
}
libraryToInstall = args[i];
}
if (a == ACTION.VERSION) {
BaseNoGui.showMessage("Arduino", BaseNoGui.VERSION_NAME_LONG);
System.exit(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I like this exit here, this bypasses any cleanup that would normally (perhaps) run after this function returns. Also, this function is expected to parse arguments only, not act on them. Also, passing --version --verify now just acts on --version, instead of showing an error that only one of them can be passed.

Better would seem to set action here, and act on it elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right!
Thank you for your comment.

yohsuke added 2 commits May 3, 2018 01:06
Move print action to probably suitable place.

This commit will fix the behavior of multiple actions about --version.
@shepting
Copy link

@matthijskooijman Is this better with the changes?

Copy link
Collaborator

@matthijskooijman matthijskooijman left a comment

Choose a reason for hiding this comment

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

Looks perfect to me like this. I would only suggest merging the commits into a single one, but I guess that can be done by @facchinm or @cmaglie when merging this PR.

@cmaglie cmaglie merged commit 24029c5 into arduino:master May 22, 2018
@cmaglie cmaglie added this to the Release 1.8.6 milestone May 22, 2018
cmaglie added a commit that referenced this pull request May 22, 2018
@yohsuke
Copy link
Contributor Author

yohsuke commented May 22, 2018

Thank you, reviewers!

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.

5 participants