seqeralabs / tower-cli

Nextflow Tower CLI tool
Apache License 2.0
40 stars 9 forks source link

Partial matching behavior on tw pipelines command #360

Open markpanganiban opened 7 months ago

markpanganiban commented 7 months ago

The pipeline subcommand will return an error when there are multiple matches with the pipeline name.

Example below:

mark@LAPTOP-CURHNF2E:~/scripts/tw$ ./tw pipelines view -n 'mark-slurm' -w 'seqeralabs/testing'

 ERROR: Multiple pipelines match 'mark-slurm' at [seqeralabs / testing] workspace

mark@LAPTOP-CURHNF2E:~/scripts/tw$ ./tw pipelines view -n 'hello-mark-slurm' -w 'seqeralabs/testing'

  Pipeline at [seqeralabs / testing] workspace:

    --------------+-------------------------------------------
     ID           | 10884606264418
     Name         | hello-mark-slurm
     Description  |
     Repository   | https://github.com/markpanganiban/nf-test
     Compute env. | mark-slurm
     Labels       | No labels found
jordeu commented 7 months ago

Can you give it a try to this:

./tw pipelines view -n '"mark-slurm"' -w 'seqeralabs/testing'

The option to use quotes to do a exact search was added at API level few months ago, not sure if this works at CLI.

markpanganiban commented 7 months ago

It works with quotes! Thanks Jordi.

$ ./tw pipelines view -n '"mark-slurm"' -w 'seqeralabs/testing'

  Pipeline at [seqeralabs / testing] workspace:

    --------------+-------------------------------------------
     ID           | 149276434439194
     Name         | mark-slurm
     Description  |
     Repository   | https://github.com/markpanganiban/nf-test
     Compute env. | mark-slurm
     Labels       | No labels found

Shall we clarify this behavior on our tw-cli docs?

jordeu commented 7 months ago

I think that the CLI should automatically add the quotes (unless they are already added). This was not done when this was implemented because it was not supported on API side.

I don't see any use case that you want to do a partial string match here.

drpatelh commented 7 months ago

Agree 👍🏽 Default behaviour should be exact matching.