Skip to content

Feature: Don't print location for mbed config for easier parsing. #790

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 2 commits into from
Feb 11, 2019

Conversation

screamerbg
Copy link
Contributor

@MarceloSalazar raised that #780 broke the parser he wrote for mbed config -G KEY which is used to extract configuration from Mbed CLI and use with other tools. This PR aims to fix this and restore the old behavior for mbed config.

CC @MarceloSalazar

action('Program path \"%s\"' % Program(cwd_root).path)
if not sys.argv[1].lower() in ["config"]: # `mbed config` should be parse-friendly
action('Working path \"%s\" (%s)' % (cwd_root, pathtype))
if pathtype == "library":
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this line need to change from == to != ?

Copy link
Contributor Author

@screamerbg screamerbg Nov 14, 2018

Choose a reason for hiding this comment

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

Because when you use mbed CLI on a directory that cannot be associated with a project, getting "Program path" message is very confusing - it may not be program at all. Also in the case of folder, the two print statements report the same folder.

Copy link
Contributor

Choose a reason for hiding this comment

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

Kk. Was primarily wondering if some third pathtype was present elsewhere, but that makes sense.

mbed/mbed.py Outdated
action('Working path \"%s\" (%s)' % (cwd_root, pathtype))
if pathtype != "program":
action('Program path \"%s\"' % Program(cwd_root).path)
if not sys.argv[1].lower() in ["config"]: # `mbed config` should be parse-friendly
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason for doing in ["config"] instead of is "config"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what happens if a config alias is used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I hope the updated PR answers the question :)

@screamerbg
Copy link
Contributor Author

Not sure how the PR got closed...

@screamerbg
Copy link
Contributor Author

Whops, I deleted my own branch, sorry.

@screamerbg screamerbg reopened this Nov 15, 2018
mbed/mbed.py Outdated
action('Working path \"%s\" (%s)' % (cwd_root, pathtype))
if pathtype != "program":
action('Program path \"%s\"' % Program(cwd_root).path)
if not sys.argv[1].lower() in ["config", "cfg", "conf"]: # `mbed config` should be parse-friendly
Copy link
Contributor

@theotherjimmy theotherjimmy Nov 15, 2018

Choose a reason for hiding this comment

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

Perhaps this the list of config subcommand names should be a global, so that if I add another alias for config I don't have to add it into two places. You could also remove the comment at that point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what's the proposal? Modify the subcommand routine so for every command there's a list of aliases?

Copy link
Contributor

@theotherjimmy theotherjimmy Feb 8, 2019

Choose a reason for hiding this comment

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

make ["config", "cfg", "conf"] a global variable constant.

cmonr
cmonr previously approved these changes Nov 15, 2018
Copy link
Contributor

@cmonr cmonr left a comment

Choose a reason for hiding this comment

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

Approving, since I realized my brain fart from last night about the "in" syntax.

However, would like to see this fixed such that the lists don't need to be duplicated to make maintenance less of an issue (aka what @theotherjimmy said). Don't know the urgency of this fix.

@bridadan
Copy link
Contributor

This PR will need a rebase to bring in the fixes for the Circle CI configuration.

@screamerbg screamerbg changed the title Don't print location for mbed config for easier parsing. Feature: Don't print location for mbed config for easier parsing. Feb 1, 2019
@theotherjimmy theotherjimmy merged commit 88f1714 into ARMmbed:master Feb 11, 2019
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.

4 participants