diff --git a/CHANGELOG-nightly.md b/CHANGELOG-nightly.md index 99daf2b..55903cf 100644 --- a/CHANGELOG-nightly.md +++ b/CHANGELOG-nightly.md @@ -8,6 +8,7 @@ will be backported to the master branch at every major release. When backporting changes to master, we should keep only the entries that correspond to user- facing changes. --> +- [Improvement] Add the `-h` help option to all commands and subcommands. Previously, we could only use `--help`, which is quite long for lazy fingers. (by @regisb) - 💥[Feature] Add an extensible `local/dev/k8s do ...` command to trigger custom job commands. These commands are used to run a series of bash scripts in designated containers. Any plugin can add custom jobs thanks to the `CLI_DO_COMMANDS` filter. This causes the following breaking changes: - The "init", "createuser", "settheme", "importdemocourse" commands were all migrated to this new interface. For instance, `tutor local init` was replaced by `tutor local do init`. - Plugin developers are encouraged to replace calls to the `COMMANDS_INIT` and `COMMANDS_PRE_INIT` filters by `CLI_DO_INIT_TASKS`. diff --git a/tutor/commands/cli.py b/tutor/commands/cli.py index a4d75e0..80c6475 100755 --- a/tutor/commands/cli.py +++ b/tutor/commands/cli.py @@ -117,6 +117,7 @@ def cli(context: click.Context, root: str, show_help: bool) -> None: "/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user)" ) context.obj = Context(root) + context.help_option_names = ["-h", "--help"] if context.invoked_subcommand is None or show_help: click.echo(context.get_help()) diff --git a/tutor/commands/compose.py b/tutor/commands/compose.py index 85a95b1..7f43f19 100644 --- a/tutor/commands/compose.py +++ b/tutor/commands/compose.py @@ -306,6 +306,7 @@ def do( """ Run a custom job in the right container(s). """ + @hooks.Actions.DO_JOB.add() def _mount_tmp_volumes(_job_name: str, *_args: t.Any, **_kwargs: t.Any) -> None: """ diff --git a/tutor/commands/jobs.py b/tutor/commands/jobs.py index 9f8ac6a..db17a7d 100644 --- a/tutor/commands/jobs.py +++ b/tutor/commands/jobs.py @@ -263,8 +263,7 @@ P = ParamSpec("P") def _patch_callback( - job_name: str, - func: t.Callable[P, t.Iterable[t.Tuple[str, str]]] + job_name: str, func: t.Callable[P, t.Iterable[t.Tuple[str, str]]] ) -> t.Callable[P, None]: """ Modify a subcommand callback function such that its results are processed by `do_callback`. diff --git a/tutor/commands/k8s.py b/tutor/commands/k8s.py index 2313e28..243eb28 100644 --- a/tutor/commands/k8s.py +++ b/tutor/commands/k8s.py @@ -369,6 +369,7 @@ def do(context: K8sContext) -> None: We make sure that some essential containers (databases, proxy) are up before we launch the jobs. """ + @hooks.Actions.DO_JOB.add() def _start_base_deployments(_job_name: str, *_args: Any, **_kwargs: Any) -> None: """