From a7b43f1015a0559705f2714a680aa9f87313e603 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 28 Jan 2020 21:31:53 -0800 Subject: spack python: add -m option to run modules as scripts It's often useful to run a module with `python -m`, e.g.: python -m pyinstrument script.py Running a python script this way was hard, though, as `spack python` did not have a similar `-m` option. This PR adds a `-m` option to `spack python` so that we can do things like this: spack python -m pyinstrument ./test.py This makes it easy to write a script that uses a small part of Spack and then profile it. Previously thee easiest way to do this was to write a custom Spack command, which is often overkill. --- share/spack/spack-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'share') diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index e6b7529452..b17733e1bf 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -1272,7 +1272,7 @@ _spack_pydoc() { _spack_python() { if $list_options then - SPACK_COMPREPLY="-h --help -c" + SPACK_COMPREPLY="-h --help -c -m" else SPACK_COMPREPLY="" fi -- cgit v1.2.3-60-g2f50