Skip to content

Commit 7fa1109

Browse files
pditommasoclaudebentsherman
authored
Rename module info subcommand to module view (#7052) [ci fast]
* Rename `module info` subcommand to `module inspect` Keep `info` as a backward-compatible alias. Adds a generic `getAliases()` hook on `CmdBase` so subcommands can declare extra names, and wires it through `CmdModule` so both the JCommander parser and the usage/help lookup recognize aliases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> * Rename subcommand to `module view` and update docs Switch the new name from `inspect` to `view`. The `info` alias is still kept for backward compatibility. Update the CLI reference, module guide and 26.04 migration notes to reflect the new name. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> * update docs Signed-off-by: Ben Sherman <bentshermann@gmail.com> * update class names Signed-off-by: Ben Sherman <bentshermann@gmail.com> --------- Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> Signed-off-by: Ben Sherman <bentshermann@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: Ben Sherman <bentshermann@gmail.com>
1 parent ddc974f commit 7fa1109

8 files changed

Lines changed: 70 additions & 63 deletions

File tree

docs/cli.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,19 +323,19 @@ See {ref}`cli-module-list` for more information.
323323

324324
### Viewing module information
325325

326-
The `module info` command displays detailed metadata and usage information for a specific module from the registry.
326+
The `module view` command displays detailed metadata and usage information for a specific module from the registry.
327327

328328
Use this to understand module requirements, view input/output specifications, see available tools, or generate usage templates before installing or running a module.
329329

330330
```console
331-
$ nextflow module info nf-core/fastqc
332-
$ nextflow module info nf-core/fastqc -version 1.0.0
333-
$ nextflow module info nf-core/fastqc -output json
331+
$ nextflow module view nf-core/fastqc
332+
$ nextflow module view nf-core/fastqc -version 1.0.0
333+
$ nextflow module view nf-core/fastqc -output json
334334
```
335335

336336
The output includes the module's version, description, authors, keywords, tools, input/output channels, and a generated usage template showing how to run the module. Use `-json` for machine-readable output suitable for programmatic access.
337337

338-
See {ref}`cli-module-info` for more information.
338+
See {ref}`cli-module-view` for more information.
339339

340340
### Running modules directly
341341

@@ -358,7 +358,7 @@ $ nextflow module run nf-core/salmon \
358358
-resume
359359
```
360360

361-
Process inputs can be specified like params on the command line. For example, `--reads reads.fq` corresponds to the `reads` input in the `nf-core/salmon` module. Run `nextflow module info nf-core/salmon` to see the available params for the module.
361+
Process inputs can be specified like params on the command line. For example, `--reads reads.fq` corresponds to the `reads` input in the `nf-core/salmon` module. Run `nextflow module view nf-core/salmon` to see the available params for the module.
362362

363363
See {ref}`cli-module-run` for more information.
364364

docs/migrations/26-04.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ nextflow module run nf-core/fastqc --meta.id 1 --reads sample1.fastq
2323
# Search for modules in registry
2424
nextflow module search bwa
2525

26-
# Get info about a module
27-
nextflow module info nf-core/bwa/mem
26+
# View info about a module
27+
nextflow module view nf-core/bwa/mem
2828

2929
# Install a module
3030
nextflow module install nf-core/bwa/mem

docs/module.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,11 @@ By default, both the module files and the `.module-info` file are removed. Use t
370370

371371
### Viewing module information
372372

373-
Use the `module info` command to display metadata and a usage template for a module:
373+
Use the `module view` command to display metadata and a usage template for a module:
374374

375375
```console
376-
$ nextflow module info nf-core/fastqc
377-
$ nextflow module info nf-core/fastqc -version 1.0.0
376+
$ nextflow module view nf-core/fastqc
377+
$ nextflow module view nf-core/fastqc -version 1.0.0
378378
```
379379

380380
The output includes the module description, authors, keywords, tools, inputs, outputs, and a ready-to-use command-line template. Use `-o json` to get machine-readable output.

docs/reference/cli.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,33 +1171,6 @@ The `module` command provides a comprehensive system for managing registry-based
11711171
$ nextflow module create myorg/my-module
11721172
```
11731173

1174-
(cli-module-info)=
1175-
1176-
`info [options] [namespace/name]`
1177-
1178-
: Display detailed information about a module from the registry.
1179-
: Shows module name, version, description, and other metadata, as well as example usage.
1180-
: The following options are available:
1181-
1182-
`-version`
1183-
: Specify the module version to query (e.g., `1.0.0`). If not specified, displays information for the latest version.
1184-
1185-
`-o, -output` (`text`)
1186-
: Output mode for info results. Options: `text` (default), `json`.
1187-
1188-
: **Examples:**
1189-
1190-
```console
1191-
# Display information for latest version
1192-
$ nextflow module info nf-core/fastqc
1193-
1194-
# Display information for specific version
1195-
$ nextflow module info nf-core/fastqc -version 1.0.0
1196-
1197-
# Get results as JSON
1198-
$ nextflow module info nf-core/fastqc -output json
1199-
```
1200-
12011174
(cli-module-install)=
12021175

12031176
`install [options] [namespace/name]`
@@ -1422,6 +1395,33 @@ The `module` command provides a comprehensive system for managing registry-based
14221395
$ nextflow module validate ./modules/myorg/my-module
14231396
```
14241397

1398+
(cli-module-view)=
1399+
1400+
`view [options] [namespace/name]`
1401+
1402+
: Display detailed information about a module from the registry.
1403+
: Shows module name, version, description, and other metadata, as well as example usage.
1404+
: The following options are available:
1405+
1406+
`-version`
1407+
: Specify the module version to query (e.g., `1.0.0`). If not specified, displays information for the latest version.
1408+
1409+
`-o, -output` (`text`)
1410+
: Output format. Options: `text` (default), `json`.
1411+
1412+
: **Examples:**
1413+
1414+
```console
1415+
# Display information for latest version
1416+
$ nextflow module view nf-core/fastqc
1417+
1418+
# Display information for specific version
1419+
$ nextflow module view nf-core/fastqc -version 1.0.0
1420+
1421+
# Get results as JSON
1422+
$ nextflow module view nf-core/fastqc -output json
1423+
```
1424+
14251425
(cli-plugin)=
14261426

14271427
### `plugin`

modules/nextflow/src/main/groovy/nextflow/cli/CmdBase.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ abstract class CmdBase implements Runnable {
3030

3131
abstract String getName()
3232

33+
List<String> getAliases() { Collections.emptyList() }
34+
3335
protected List<String> getUnknownOptions(){ return this.unknownOptions }
3436

3537
void setUnknownOptions(List<String> options){ this.unknownOptions = options }

modules/nextflow/src/main/groovy/nextflow/cli/CmdModule.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import com.beust.jcommander.Parameters
2323
import groovy.transform.CompileStatic
2424
import groovy.util.logging.Slf4j
2525
import nextflow.cli.module.CmdModuleCreate
26-
import nextflow.cli.module.CmdModuleInfo
26+
import nextflow.cli.module.CmdModuleView
2727
import nextflow.cli.module.CmdModuleInstall
2828
import nextflow.cli.module.CmdModuleList
2929
import nextflow.cli.module.CmdModulePublish
@@ -57,7 +57,7 @@ class CmdModule extends CmdBase implements UsageAware {
5757
commands << new CmdModuleList()
5858
commands << new CmdModuleRemove()
5959
commands << new CmdModuleSearch()
60-
commands << new CmdModuleInfo()
60+
commands << new CmdModuleView()
6161
commands << new CmdModulePublish()
6262
commands << new CmdModuleSpec()
6363
commands << new CmdModuleValidate()
@@ -70,7 +70,7 @@ class CmdModule extends CmdBase implements UsageAware {
7070
// Register all subcommands
7171
commands.each { cmd ->
7272
cmd.launcher = this.launcher
73-
this.jCommander.addCommand(cmd.getName(), cmd, new String[0])
73+
this.jCommander.addCommand(cmd.getName(), cmd, cmd.getAliases() as String[])
7474
}
7575
}
7676
return jCommander
@@ -117,7 +117,7 @@ class CmdModule extends CmdBase implements UsageAware {
117117
}
118118

119119
private CmdBase findCmd(String name) {
120-
commands.find { it.name == name }
120+
commands.find { it.name == name || name in it.aliases }
121121
}
122122

123123
/**

modules/nextflow/src/main/groovy/nextflow/cli/module/CmdModuleInfo.groovy renamed to modules/nextflow/src/main/groovy/nextflow/cli/module/CmdModuleView.groovy

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ import java.nio.file.Path
4141
import java.nio.file.Paths
4242

4343
/**
44-
* Module info subcommand - displays module metadata and usage template
44+
* Module view subcommand - displays module info and usage template
4545
*
4646
* @author Jorge Ejarque <jorge.ejarque@seqera.io>
4747
*/
4848
@Slf4j
4949
@CompileStatic
5050
@Parameters(commandDescription = "Show module information and usage template")
51-
class CmdModuleInfo extends CmdBase {
51+
class CmdModuleView extends CmdBase {
5252

5353
@Parameter(names = ["-version"], description = "Module version")
5454
String version
@@ -82,7 +82,12 @@ class CmdModuleInfo extends CmdBase {
8282

8383
@Override
8484
String getName() {
85-
return 'info'
85+
return 'view'
86+
}
87+
88+
@Override
89+
List<String> getAliases() {
90+
return List.of('info')
8691
}
8792

8893
@Override

modules/nextflow/src/test/groovy/nextflow/cli/module/CmdModuleInfoTest.groovy renamed to modules/nextflow/src/test/groovy/nextflow/cli/module/CmdModuleViewTest.groovy

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ import test.OutputCapture
3434
import java.nio.file.Path
3535

3636
/**
37-
* Tests for CmdModuleInfo command
37+
* Tests for CmdModuleView command
3838
*
3939
* @author Jorge Ejarque <jorge.ejarque@seqera.io>
4040
*/
41-
class CmdModuleInfoTest extends Specification {
41+
class CmdModuleViewTest extends Specification {
4242

4343
@Rule
4444
OutputCapture capture = new OutputCapture()
@@ -62,7 +62,7 @@ class CmdModuleInfoTest extends Specification {
6262
)
6363

6464
and:
65-
def cmd = new CmdModuleInfo()
65+
def cmd = new CmdModuleView()
6666
cmd.args = ['nf-core/fastqc']
6767
cmd.launcher = Mock(Launcher) {
6868
getOptions() >> null
@@ -110,7 +110,7 @@ class CmdModuleInfoTest extends Specification {
110110
)
111111

112112
and:
113-
def cmd = new CmdModuleInfo()
113+
def cmd = new CmdModuleView()
114114
cmd.args = ['nf-core/fastqc']
115115
cmd.version = '0.9.0'
116116
cmd.launcher = Mock(Launcher) {
@@ -149,7 +149,7 @@ class CmdModuleInfoTest extends Specification {
149149
)
150150

151151
and:
152-
def cmd = new CmdModuleInfo()
152+
def cmd = new CmdModuleView()
153153
cmd.args = ['nf-core/fastqc']
154154
cmd.output = 'json'
155155
cmd.launcher = Mock(Launcher) {
@@ -207,7 +207,7 @@ class CmdModuleInfoTest extends Specification {
207207
)
208208

209209
and:
210-
def cmd = new CmdModuleInfo()
210+
def cmd = new CmdModuleView()
211211
cmd.args = ['nf-core/fastqc']
212212
cmd.launcher = Mock(Launcher) {
213213
getOptions() >> null
@@ -266,7 +266,7 @@ class CmdModuleInfoTest extends Specification {
266266
)
267267

268268
and:
269-
def cmd = new CmdModuleInfo()
269+
def cmd = new CmdModuleView()
270270
cmd.args = ['nf-core/fastqc']
271271
cmd.launcher = Mock(Launcher) {
272272
getOptions() >> null
@@ -324,7 +324,7 @@ class CmdModuleInfoTest extends Specification {
324324
)
325325

326326
and:
327-
def cmd = new CmdModuleInfo()
327+
def cmd = new CmdModuleView()
328328
cmd.args = ['nf-core/fastqc']
329329
cmd.launcher = Mock(Launcher) {
330330
getOptions() >> null
@@ -386,7 +386,7 @@ class CmdModuleInfoTest extends Specification {
386386
)
387387

388388
and:
389-
def cmd = new CmdModuleInfo()
389+
def cmd = new CmdModuleView()
390390
cmd.args = ['nf-core/fastqc']
391391
cmd.launcher = Mock(Launcher) {
392392
getOptions() >> null
@@ -427,7 +427,7 @@ class CmdModuleInfoTest extends Specification {
427427
)
428428

429429
and:
430-
def cmd = new CmdModuleInfo()
430+
def cmd = new CmdModuleView()
431431
cmd.args = ['nf-core/fastqc']
432432
cmd.version = '2.0.0'
433433
cmd.launcher = Mock(Launcher) {
@@ -477,7 +477,7 @@ class CmdModuleInfoTest extends Specification {
477477
)
478478

479479
and:
480-
def cmd = new CmdModuleInfo()
480+
def cmd = new CmdModuleView()
481481
cmd.args = ['nf-core/fastqc']
482482
cmd.launcher = Mock(Launcher) {
483483
getOptions() >> null
@@ -504,7 +504,7 @@ class CmdModuleInfoTest extends Specification {
504504

505505
def 'should fail with no arguments'() {
506506
given:
507-
def cmd = new CmdModuleInfo()
507+
def cmd = new CmdModuleView()
508508
cmd.launcher = Mock(Launcher) {
509509
getOptions() >> null
510510
}
@@ -520,7 +520,7 @@ class CmdModuleInfoTest extends Specification {
520520

521521
def 'should fail with multiple arguments'() {
522522
given:
523-
def cmd = new CmdModuleInfo()
523+
def cmd = new CmdModuleView()
524524
cmd.launcher = Mock(Launcher) {
525525
getOptions() >> null
526526
}
@@ -550,7 +550,7 @@ class CmdModuleInfoTest extends Specification {
550550
)
551551

552552
and:
553-
def cmd = new CmdModuleInfo()
553+
def cmd = new CmdModuleView()
554554
cmd.args = ['nf-core/fastqc']
555555
cmd.launcher = Mock(Launcher) {
556556
getOptions() >> null
@@ -593,7 +593,7 @@ class CmdModuleInfoTest extends Specification {
593593
)
594594

595595
and:
596-
def cmd = new CmdModuleInfo()
596+
def cmd = new CmdModuleView()
597597
cmd.args = ['nf-core/fastqc']
598598
cmd.launcher = Mock(Launcher) {
599599
getOptions() >> null
@@ -649,7 +649,7 @@ class CmdModuleInfoTest extends Specification {
649649
)
650650

651651
and:
652-
def cmd = new CmdModuleInfo()
652+
def cmd = new CmdModuleView()
653653
cmd.args = ['nf-core/fastqc']
654654
cmd.launcher = Mock(Launcher) {
655655
getOptions() >> null
@@ -701,7 +701,7 @@ class CmdModuleInfoTest extends Specification {
701701
)
702702

703703
and:
704-
def cmd = new CmdModuleInfo()
704+
def cmd = new CmdModuleView()
705705
cmd.args = ['nf-core/fastqc']
706706
cmd.output = 'json'
707707
cmd.launcher = Mock(Launcher) {
@@ -776,7 +776,7 @@ class CmdModuleInfoTest extends Specification {
776776
)
777777

778778
and:
779-
def cmd = new CmdModuleInfo()
779+
def cmd = new CmdModuleView()
780780
cmd.args = ['nf-core/fastqc']
781781
cmd.output = 'json'
782782
cmd.launcher = Mock(Launcher) {

0 commit comments

Comments
 (0)