From 8320f8071185f28e67ad06e2c26294c1cfb0815b Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 11 Jan 2024 15:38:56 +0100 Subject: [PATCH 1/4] Add Trogon Signed-off-by: Phil Ewels --- nf_core/__main__.py | 5 +++-- requirements-dev.txt | 8 ++++---- requirements.txt | 5 +++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 194b2030be..4e7b5dda87 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -9,6 +9,7 @@ import rich.logging import rich.traceback import rich_click as click +from trogon import tui from nf_core import __version__ from nf_core.download import DownloadError @@ -30,7 +31,7 @@ "nf-core": [ { "name": "Commands for users", - "commands": ["list", "launch", "create-params-file", "download", "licences"], + "commands": ["list", "launch", "create-params-file", "download", "licences", "tui"], }, { "name": "Commands for developers", @@ -110,7 +111,7 @@ def run_nf_core(): # Launch the click cli nf_core_cli(auto_envvar_prefix="NFCORE") - +@tui() @click.group(context_settings=dict(help_option_names=["-h", "--help"])) @click.version_option(__version__) @click.option("-v", "--verbose", is_flag=True, default=False, help="Print verbose output to the console.") diff --git a/requirements-dev.txt b/requirements-dev.txt index 6d890f0e1f..9fbb49c10c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,13 +1,13 @@ +mypy myst_parser pytest-cov pytest-datafiles responses +ruff Sphinx sphinx-rtd-theme -mypy -types-PyYAML -types-requests types-jsonschema types-Markdown +types-PyYAML +types-requests types-setuptools -ruff diff --git a/requirements.txt b/requirements.txt index add52f4bc6..526efb7306 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,10 +5,11 @@ jinja2 jsonschema>=3.0 markdown>=3.3 packaging +pdiff pre-commit prompt_toolkit>=3.0.3 -pytest>=7.0.0 pytest-workflow>=1.6.0 +pytest>=7.0.0 pyyaml questionary>=1.8.0 refgenie @@ -17,4 +18,4 @@ requests_cache rich-click>=1.6.1 rich>=13.3.1 tabulate -pdiff +trogon From 41a61649e47895e7d5e9e2d55bc3b80096a6e3c5 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Thu, 11 Jan 2024 21:28:50 +0000 Subject: [PATCH 2/4] Fix ruff linting --- nf_core/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 4e7b5dda87..e02464b922 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -111,6 +111,7 @@ def run_nf_core(): # Launch the click cli nf_core_cli(auto_envvar_prefix="NFCORE") + @tui() @click.group(context_settings=dict(help_option_names=["-h", "--help"])) @click.version_option(__version__) From a31fa1f147cd03ce5fa1b459f15d17cff1268b15 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 12 Jan 2024 16:01:03 +0000 Subject: [PATCH 3/4] add to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e2600afe9..f89b04e4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - update python image version in docker file ([#2636](https://github.com/nf-core/tools/pull/2636)) - Set pdiff as nf-test differ in Docker image for Gitpod ([#2642](https://github.com/nf-core/tools/pull/2642)) - Fix Renovate Dockerfile updating issues ([#2648](https://github.com/nf-core/tools/pull/2648) and [#2651](https://github.com/nf-core/tools/pull/2651)) +- Add new subcommand `nf-core tui`, which launches a TUI (terminal user interface) to intuitively explore the command line flags, built using [Trogon](https://github.com/Textualize/trogon) ([#2655](https://github.com/nf-core/tools/pull/2655)) # [v2.11.1 - Magnesium Dragon Patch](https://github.com/nf-core/tools/releases/tag/2.11) - [2023-12-20] From a616de27bc6bdb62ab521805aad061311710de77 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Fri, 12 Jan 2024 16:40:34 +0000 Subject: [PATCH 4/4] Add to the readme --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index dacf7eab71..c612c442b8 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ A python package with helper tools for the nf-core community. - [`nf-core schema` - Work with pipeline schema files](#pipeline-schema) - [`nf-core bump-version` - Update nf-core pipeline version number](#bumping-a-pipeline-version-number) - [`nf-core sync` - Synchronise pipeline TEMPLATE branches](#sync-a-pipeline-with-the-template) +- [`nf-core tui` - Explore the nf-core command line graphically](#tools-cli-tui) - [`nf-core modules` - commands for dealing with DSL2 modules](#modules) - [`modules list` - List available modules](#list-modules) @@ -731,6 +732,17 @@ To create the pull request, a personal access token is required for API authenti These can be created at [https://github.com/settings/tokens](https://github.com/settings/tokens). Supply this using the `--auth-token` flag. +## Tools CLI TUI + +_CLI:_ Command line interface +_TUI:_ Terminal user interface + +The `nf-core` command line interface is fairly large, with a lot of commands and options. +To make it easier to explore and use, run `nf-core tui` to launch a graphical terminal interface. + +This functionality works using [Textualize/trogon](https://github.com/Textualize/trogon) +and is based on the underlying CLI implementation that uses [Click](https://click.palletsprojects.com/). + ## Modules With the advent of [Nextflow DSL2](https://www.nextflow.io/docs/latest/dsl2.html), we are creating a centralised repository of modules.