As new features are introduced in API Connect, more commands are being added to the CLI as well. With the growing number of commands and sub-commands, it is often difficult to keep track of all of them and their purposes. Having proper documentation helps developers to quickly integrate the commands into their existing workflows.
With APIC CLI, we can generate the markdown documentation for the commands from the CLI itself. Yes, you heard that right!
Docs command
The docs command in the CLI can be used to generate markdown documentation for all available commands. Based on the CLI version in use, it will create documentation corresponding to that specific version.
Below is a sample output of the docs command. As you can see, it generates .md files for each command and sub-command. The folder structure helps users easily navigate to the specific command they are interested in.
apic docs

By default, it will create a new folder called docs in the current working directory. To change the path, you can provide the desired path along with the command.
apic docs my_path/new
Specifying the mode
The default CLI operation mode is apim, unless configured otherwise. This means that the documentation will be generated only for the commands belonging to the same mode. To generate documentation for a different mode, you can use the --mode option.
The example below shows how to create documentation specific to the portal commands.
apic docs --mode portaladmin

Using all flag
To generate the docs for all commands irrespective of operation mode, we can make use of the --all flag. This will generate the markdown docs for all the available commands in one place in an organized structure. This is available from APIC v10.0.8.1
apic docs --all
So far, we have seen the different options to create markdown documentation from the APIC CLI on demand.
Ready to explore more?
https://ibm-apiconnect.github.io/clidocs/