mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Fix script command and testing:
- Use string format compatible with python 2.7 - Use `click.echo`, not `print` - The command is `pipenv script` not `pipenv scripts` - The stanza label in Pipfile is `[scripts]`, not `[script]` - The default when getting from the pipfile should be dict, not a list
This commit is contained in:
@@ -727,12 +727,13 @@ def script(state, args):
|
||||
"""Lists scripts in current environment config."""
|
||||
from ..core import project
|
||||
if not project:
|
||||
print("project not found")
|
||||
echo(u"project not found", err=True)
|
||||
exit(1)
|
||||
scripts = project.parsed_pipfile.get('scripts', [])
|
||||
print("command\tscript")
|
||||
scripts = project.parsed_pipfile.get('scripts', {})
|
||||
rpt = u"command\tscript\n"
|
||||
for k, v in scripts.items():
|
||||
print(f"{k}\t{v}")
|
||||
rpt += u"{0}\t{1}".format(k, v)
|
||||
echo(rpt)
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ def test_scripts(PipenvInstance):
|
||||
with PipenvInstance() as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
contents = """
|
||||
[script]
|
||||
[scripts]
|
||||
pyver = "which python"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
|
||||
Reference in New Issue
Block a user