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

Make dotenv get only show the value instead of key=value #313

Merged
merged 1 commit into from Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Changed

- Make `dotenv get <key>` only show the value, not `key=value` (#313 by [@bbc2]).

### Added

- Add `--override`/`--no-override` option to `dotenv run` (#312 by [@zueve] and [@bbc2]).
Expand Down
2 changes: 1 addition & 1 deletion src/dotenv/cli.py
Expand Up @@ -85,7 +85,7 @@ def get(ctx, key):
)
stored_value = get_key(file, key)
if stored_value:
click.echo('%s=%s' % (key, stored_value))
click.echo(stored_value)
else:
exit(1)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Expand Up @@ -35,7 +35,7 @@ def test_get_existing_value(cli, dotenv_file):

result = cli.invoke(dotenv_cli, ['--file', dotenv_file, 'get', 'a'])

assert (result.exit_code, result.output) == (0, "a=b\n")
assert (result.exit_code, result.output) == (0, "b\n")


def test_get_non_existent_value(cli, dotenv_file):
Expand Down Expand Up @@ -124,7 +124,7 @@ def test_get_default_path(tmp_path):

result = sh.dotenv("get", "a")

assert result == "a=b\n"
assert result == "b\n"


def test_run(tmp_path):
Expand Down