Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested subcommands improvement #107

Open
marekvi95 opened this issue Jun 20, 2022 · 1 comment
Open

Nested subcommands improvement #107

marekvi95 opened this issue Jun 20, 2022 · 1 comment

Comments

@marekvi95
Copy link

marekvi95 commented Jun 20, 2022

Hello, thanks for the plugin, it's an excellent tool for documenting click-based apps.

I would like to ask you for improvement. We are using sphinx-click together with the sphinx.ext.autosectionlabel extension. However, there's a problem with subcommands with the same name.
For example, we have two applications that share some of their subcommand names:

  tphost                Application to secure Trust provisioning process of loading application in Un-..
  ├── check-log-owner   Check whether TP Device ID matches the ID in audit log.
  ├── device-help       Command prints help for all devices or optionally only for specified.
  ├── get-cfg-template  Command to generate tphost template of configuration YML file.
  ├── get-counters      Get Provisioning counters from TP device.
  ├── list-tpdevices    Command prints all supported and connected TP devices.
  ├── list-tptargets    Command prints all supported and connected TP targets.
  ├── load              Command to provision target MCU.
  ├── target-help       Command prints help for all targets or optionally only for specified.
  └── verify            Verify audit log integrity and optionally extract certificates.

and

  tpconfig              Application for configuration of trusted device.
  ├── device-help       Command prints help for all devices or optionally only for specified.
  ├── get-cfg-template  Command to generate tphost template of configuration YML file.
  ├── get-counters      Get Provisioning counters from TP device.
  ├── list-tpdevices    Command prints all supported and connected TP devices.
  ├── load              Command to load configuration to the TP device.
  └── seal              Seal the smart card (advancing its lifecycle to PRODUCTION).

The problem is that each subcommand is a label that is not unique. So when we use it together with autosectionlabel we duplicate labels get warnings:

tphost.rst:2: WARNING: duplicate label load, other instance in tpconfig.rst

The solution is to set nested to "none" but it's useless in this case... So would it be possible to somehow add prefixes to labels of subcommands?

Prefix would be really useful for commands with more than one level of nesting, for example this:

  nxpimage                   NXP Image tool.
  ├── ahab                   Group of sub-commands related to AHAB.
  │   ├── export             Generate AHAB Image from YAML/JSON configuration.
  │   ├── get-template       Create template of configuration in YAML format.
  │   └── parse              Parse AHAB Image into YAML configuration and binary images.
  ├── bootable-image         Group of bootable image utilities.
  │   ├── fcb                FCB (Flash Configuration Block) utilities.
  │   │   ├── export         Export FCB Image from YAML/JSON configuration.
  │   │   ├── get-templates  Create template of configurations in YAML format fro all memory types.
  │   │   └── parse          Parse FCB Image into YAML configuration and binary images.
  │   ├── get-templates      Create template of configurations in YAML format from all memory types.
  │   ├── merge              Merge boot image blocks into one bootable image.
  │   └── parse              Parse Bootable Image into YAML configuration and binary images.
...

thanks

@stephenfin
Copy link
Member

I think #100 would address this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants