7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-07 00:20:49 +00:00

feat: add -h help option to all commands

This commit is contained in:
Régis Behmo 2022-11-11 14:13:36 +01:00 committed by Régis Behmo
parent 16e6131f96
commit 0453b0c002
5 changed files with 5 additions and 2 deletions

View File

@ -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`.

View File

@ -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())

View File

@ -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:
"""

View File

@ -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`.

View File

@ -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:
"""