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

SwitchAttr support of values via environment variables #216

Merged
merged 2 commits into from
Aug 31, 2015

Conversation

tigrawap
Copy link
Contributor

No description provided.

# Extracting arguments from environment variables
envindex = 0
for env, swinfo in self._switches_by_envar.items():
envindex-=1
Copy link
Owner

Choose a reason for hiding this comment

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

what is the negative index used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SwitchParseInfo requires index, which later is used for sorting, I think that using same index as before will be wrong, command line arguments and environment variables arguments are not really same indexes. But since it's used later for sorting(and probably some other things that I did not notice) - indexes are required, so negative is like "pre-command line " indexes
But maybe you have another idea how to handle this

@tomerfiliba
Copy link
Owner

added some comments -- thanks!

@henryiii
Copy link
Collaborator

Very handy idea! I can help add docs when it's ready.

Sent from my iPhone

On Aug 30, 2015, at 1:35 PM, Tomer Filiba [email protected] wrote:

added some comments -- thanks!


Reply to this email directly or view it on GitHub.

SwitchAttr now receives envname kwarg
If both environment variable and command line argument provided - command line wins(considered override)
Environment variables does not have list syntax at the moment (single value will be passed as list, same as single value with command line attribute)
@tigrawap
Copy link
Contributor Author

Updated basing on comments, squashed, ready to merge

tomerfiliba added a commit that referenced this pull request Aug 31, 2015
SwitchAttr support of values via environment variables
@tomerfiliba tomerfiliba merged commit c3be829 into tomerfiliba:master Aug 31, 2015
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.

3 participants