aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
431 stars 187 forks source link

`verdi node graph generate` error for missing PK is not correctly handled and help page is wrong #6397

Closed agoscinski closed 4 months ago

agoscinski commented 4 months ago

Describe the bug / Steps to reproduce / Expected behavior

Error: Missing argument 'COMPUTER'.

The error seems not to be properly handled in the former case.

- The help page of the command is wrong
```bash
$ verdi node graph generate --help
Usage: verdi node graph generate [OPTIONS] [--] [ROOT_NODE] OUTPUT_FILE

  Generate a graph from one or multiple root nodes.
[...]

Again comparing it with other commands, I interpret [ROOT_NODE] as optional, but it is not, it is the OUTPUT_FILE which is optional. Also verdi node graph generate -N 1 output.pdf does not work but one has to do verdi node graph generate -N 1 -O output.pdf

Your environment

sphuber commented 4 months ago

This is a regression introduced by #6338 which made it possible to specify multiple root nodes using the -N option. Specifying the node positionally was deprecated and had to be made optional, so the help string is correct. It is generated automatically by click by the way.

The problem here is the handling of the case where no root node is specified neither positionally nor with -N.