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

Provide all command args as keywords #197

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions spin/cmds/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ def _check_coverage_tool_installation(coverage_type: GcovReportFormat):
help="Enable C code coverage using `gcov`. Use `spin test --gcov` to generate reports.",
)
@click.argument("meson_args", nargs=-1)
def build(meson_args, jobs=None, clean=False, verbose=False, gcov=False, quiet=False):
def build(
*, meson_args, jobs=None, clean=False, verbose=False, gcov=False, quiet=False
):
"""🔧 Build package with Meson/ninja

The package is installed to `build-install`.
Expand Down Expand Up @@ -370,6 +372,7 @@ def _get_configured_command(command_name):
@click.pass_context
def test(
ctx,
*,
pytest_args,
n_jobs,
tests,
Expand Down Expand Up @@ -543,7 +546,7 @@ def test(
@click.option("--code", "-c", help="Python program passed in as a string")
@click.argument("gdb_args", nargs=-1)
@click.pass_context
def gdb(ctx, code, gdb_args):
def gdb(ctx, *, code, gdb_args):
"""👾 Execute code through GDB

spin gdb -c 'import numpy as np; print(np.__version__)'
Expand Down Expand Up @@ -595,7 +598,7 @@ def gdb(ctx, code, gdb_args):
@click.command()
@click.argument("ipython_args", nargs=-1)
@click.pass_context
def ipython(ctx, ipython_args):
def ipython(ctx, *, ipython_args):
"""💻 Launch IPython shell with PYTHONPATH set

IPYTHON_ARGS are passed through directly to IPython, e.g.:
Expand Down Expand Up @@ -649,7 +652,7 @@ def shell(ctx, shell_args=[]):
@click.command()
@click.argument("python_args", nargs=-1)
@click.pass_context
def python(ctx, python_args):
def python(ctx, *, python_args):
"""🐍 Launch Python shell with PYTHONPATH set

PYTHON_ARGS are passed through directly to Python, e.g.:
Expand Down Expand Up @@ -690,7 +693,7 @@ def python(ctx, python_args):
@click.command(context_settings={"ignore_unknown_options": True})
@click.argument("args", nargs=-1)
@click.pass_context
def run(ctx, args):
def run(ctx, *, args):
"""🏁 Run a shell command with PYTHONPATH set

\b
Expand Down Expand Up @@ -764,7 +767,7 @@ def run(ctx, args):
)
@click.option("--jobs", "-j", default="auto", help="Number of parallel build jobs")
@click.pass_context
def docs(ctx, sphinx_target, clean, first_build, jobs, sphinx_gallery_plot):
def docs(ctx, *, sphinx_target, clean, first_build, jobs, sphinx_gallery_plot):
"""📖 Build Sphinx documentation

By default, SPHINXOPTS="-W", raising errors on warnings.
Expand Down Expand Up @@ -847,7 +850,7 @@ def docs(ctx, sphinx_target, clean, first_build, jobs, sphinx_gallery_plot):
@click.option("--code", "-c", help="Python program passed in as a string")
@click.argument("lldb_args", nargs=-1)
@click.pass_context
def lldb(ctx, code, lldb_args):
def lldb(ctx, *, code, lldb_args):
"""👾 Execute code through LLDB

spin lldb -c 'import numpy as np; print(np.__version__)'
Expand Down
Loading