-
Notifications
You must be signed in to change notification settings - Fork 4
PR for Issues #7 #8
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
5ebe11f
a0d1b67
5378d9f
56b60fc
10581ea
afaf54c
0943780
2d07732
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,7 +63,7 @@ def setenv(name="", value=None, user=False, append=False, delete=False, list_all | |
| elif delete: | ||
| result = delete_variable(name, user) | ||
| else: | ||
| result = get_variable(name, user) | ||
| result = get_variable(name, user, suppress_echo) | ||
|
|
||
| if not suppress_echo: | ||
| click.echo(result) | ||
|
|
@@ -97,7 +97,7 @@ def append_variable(name, value, user): | |
| return result | ||
|
|
||
|
|
||
| def get_variable(name, user): | ||
| def get_variable(name, user, suppress_echo): | ||
| """ | ||
| Gets the value of environment variable | ||
| """ | ||
|
|
@@ -107,8 +107,9 @@ def get_variable(name, user): | |
| value, regtype = winreg.QueryValueEx(key, name) | ||
| return value | ||
| except WindowsError: | ||
| click.echo("Environment Variable '{}' does not exist".format(name)) | ||
| return "" | ||
| if not suppress_echo: | ||
| click.echo("Environment Variable '{}' does not exist".format(name)) | ||
| raise KeyError | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have some concerns how this will work in CLI implementation. It will be a long unreadable traceback. I think we need to raise a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also unittests fail with current implementation. Need to fix it as well |
||
|
|
||
| def delete_variable(name, user): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.