Skip to content

Commit

Permalink
Changed the export option to save the dot file without a bash extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
jadutter committed Sep 6, 2020
1 parent 6b50c84 commit 5a51bde
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 0 additions & 4 deletions src/dotenv/cli.py
Expand Up @@ -35,10 +35,6 @@ def cli(ctx, file, quote, export):
ctx.obj = {}
ctx.obj['QUOTE'] = quote
ctx.obj['EXPORT'] = export
if ctx.obj['EXPORT']:
name, extension = os.path.splitext(file)
if not extension:
file = name+".sh"
ctx.obj['FILE'] = file


Expand Down
3 changes: 1 addition & 2 deletions tests/test_cli.py
Expand Up @@ -90,7 +90,7 @@ def test_set_quote_options(cli, dotenv_file, quote_mode, variable, value, expect
@pytest.mark.parametrize(
"dotenv_file,export_mode,variable,value,expected",
(
(".nx_file.sh", "true", "HELLO", "WORLD", "export HELLO=\"WORLD\"\n"),
(".nx_file", "true", "HELLO", "WORLD", "export HELLO=\"WORLD\"\n"),
(".nx_file", "false", "HELLO", "WORLD", "HELLO=\"WORLD\"\n"),
)
)
Expand All @@ -99,7 +99,6 @@ def test_set_export(cli, dotenv_file, export_mode, variable, value, expected):
dotenv_cli,
["--file", dotenv_file, "--quote", "always", "--export", export_mode, "set", variable, value]
)
assert result.exit_code == 0, result.output

assert (result.exit_code, result.output) == (0, "{}={}\n".format(variable, value))
assert open(dotenv_file, "r").read() == expected
Expand Down

0 comments on commit 5a51bde

Please sign in to comment.