dogtagpki / pki

The Dogtag Certificate System is an enterprise-class Certificate Authority (CA) which supports all aspects of certificate lifecycle management, including key archival, OCSP and smartcard management.
https://www.dogtagpki.org
GNU General Public License v2.0
374 stars 138 forks source link

Provide easy method to display a "tree" of all possible CLI commands #1539

Open pki-bot opened 4 years ago

pki-bot commented 4 years ago

This issue was migrated from Pagure Issue #973. Originally filed by mharmsen (@mharmsen) on 2014-04-23 01:15:56:


During the process of working on numerous CLI tickets, I have come to the conclusion that it would be highly beneficial to provide a means whereby each and every command-line available to an end user could be displayed.

I would suggest that either a new option be added to the pki command such as --commands or --tree, or a new script be included which provides a listing similar to the following:

pki
 |_ ca
    |_ ca-audit
       |_ ca-audit-mod
       |_ ca-audit-show
    |_ ca-cert
       |_ ca-cert-find
       |_ ca-cert-show
       |_ ca-cert-revoke
       |_ ca-cert-hold
       |_ ca-cert-release-hold
       |_ ca-cert-request-find
       |_ ca-cert-request-show
       |_ ca-cert-request-submit
       |_ ca-cert-request-review
       |_ ca-cert-request-profile-find
       |_ ca-cert-request-profile-show
    |_ ca-group
       |_ ca-group-find
       |_ ca-group-show
       |_ ca-group-add
       |_ ca-group-mod
       |_ ca-group-del
       |_ ca-group-member
          |_ ca-group-member-find
          |_ ca-group-member-show
          |_ ca-group-member-add
          |_ ca-group-member-del
    |_ ca-kraconnector
       |_ ca-kraconnector-add
       |_ ca-kraconnector-del
    |_ ca-profile
       |_ ca-profile-find
       |_ ca-profile-show
       |_ ca-profile-add
       |_ ca-profile-mod
       |_ ca-profile-del
       |_ ca-profile-enable
       |_ ca-profile-disable
    |_ ca-selftest
       |_ ca-selftest-find
       |_ ca-selftest-run
       |_ ca-selftest-show
    |_ ca-user
       |_ ca-user-find
       |_ ca-user-show
       |_ ca-user-add
       |_ ca-user-mod
       |_ ca-user-del
       |_ ca-user-cert
          |_ ca-user-cert-find
          |_ ca-user-cert-show
          |_ ca-user-cert-add
          |_ ca-user-cert-del
       |_ ca-user-membership
          |_ ca-user-membership-find
          |_ ca-user-membership-add
          |_ ca-user-membership-del
 |_ cert
    |_ cert-find
    |_ cert-show
    |_ cert-revoke
    |_ cert-hold
    |_ cert-release-hold
    |_ cert-request-find
    |_ cert-request-show
    |_ cert-request-submit
    |_ cert-request-review
    |_ cert-request-profile-find
    |_ cert-request-profile-show
 |_ client
    |_ client-init
    |_ client-cert-find
    |_ client-cert-import
    |_ client-cert-del
 |_ group
    |_ group-find
    |_ group-show
    |_ group-add
    |_ group-mod
    |_ group-del
    |_ group-member
       |_ group-member-find
       |_ group-member-show
       |_ group-member-add
       |_ group-member-del
 |_ help
 |_ key
    |_ key-find
    |_ key-request-find
    |_ key-show
    |_ key-request-show
    |_ key-mod
    |_ key-template-find
    |_ key-template-show
    |_ key-archive
    |_ key-retrieve
    |_ key-generate
    |_ key-recover
    |_ key-request-review
 |_ kra
    |_ kra-audit
       |_ kra-audit-mod
       |_ kra-audit-show
    |_ kra-group
       |_ kra-group-find
       |_ kra-group-show
       |_ kra-group-add
       |_ kra-group-mod
       |_ kra-group-del
       |_ kra-group-member
          |_ kra-group-member-find
          |_ kra-group-member-show
          |_ kra-group-member-add
          |_ kra-group-member-del
    |_ kra-key
       |_ kra-key-find
       |_ kra-key-request-find
       |_ kra-key-show
       |_ kra-key-request-show
       |_ kra-key-mod
       |_ kra-key-template-find
       |_ kra-key-template-show
       |_ kra-key-archive
       |_ kra-key-retrieve
       |_ kra-key-generate
       |_ kra-key-recover
       |_ kra-key-request-review
    |_ kra-selftest
       |_ kra-selftest-find
       |_ kra-selftest-run
       |_ kra-selftest-show
    |_ kra-user
       |_ kra-user-find
       |_ kra-user-show
       |_ kra-user-add
       |_ kra-user-mod
       |_ kra-user-del
       |_ kra-user-cert
          |_ kra-user-cert-find
          |_ kra-user-cert-show
          |_ kra-user-cert-add
          |_ kra-user-cert-del
       |_ kra-user-membership
          |_ kra-user-membership-find
          |_ kra-user-membership-add
          |_ kra-user-membership-del
 |_ ocsp
    |_ ocsp-audit
       |_ ocsp-audit-mod
       |_ ocsp-audit-show
    |_ ocsp-group
       |_ ocsp-group-find
       |_ ocsp-group-show
       |_ ocsp-group-add
       |_ ocsp-group-mod
       |_ ocsp-group-del
       |_ ocsp-group-member
          |_ ocsp-group-member-find
          |_ ocsp-group-member-show
          |_ ocsp-group-member-add
          |_ ocsp-group-member-del
    |_ ocsp-selftest
       |_ ocsp-selftest-find
       |_ ocsp-selftest-run
       |_ ocsp-selftest-show
    |_ ocsp-user
       |_ ocsp-user-find
       |_ ocsp-user-show
       |_ ocsp-user-add
       |_ ocsp-user-mod
       |_ ocsp-user-del
       |_ ocsp-user-cert
          |_ ocsp-user-cert-find
          |_ ocsp-user-cert-show
          |_ ocsp-user-cert-add
          |_ ocsp-user-cert-del
       |_ ocsp-user-membership
          |_ ocsp-user-membership-find
          |_ ocsp-user-membership-add
          |_ ocsp-user-membership-del
 |_ securitydomain
    |_ securitydomain-get-install-token
    |_ securitydomain-show
 |_ tks
    |_ tks-audit
       |_ tks-audit-mod
       |_ tks-audit-show
    |_ tks-group
       |_ tks-group-find
       |_ tks-group-show
       |_ tks-group-add
       |_ tks-group-mod
       |_ tks-group-del
       |_ tks-group-member
          |_ tks-group-member-find
          |_ tks-group-member-show
          |_ tks-group-member-add
          |_ tks-group-member-del
    |_ tks-selftest
       |_ tks-selftest-find
       |_ tks-selftest-run
       |_ tks-selftest-show
    |_ tks-tpsconnector
       |_ tks-tpsconnector-add
       |_ tks-tpsconnector-find
       |_ tks-tpsconnector-mod
       |_ tks-tpsconnector-del
    |_ tks-user
       |_ tks-user-find
       |_ tks-user-show
       |_ tks-user-add
       |_ tks-user-mod
       |_ tks-user-del
       |_ tks-user-cert
          |_ tks-user-cert-find
          |_ tks-user-cert-show
          |_ tks-user-cert-add
          |_ tks-user-cert-del
       |_ tks-user-membership
          |_ tks-user-membership-find
          |_ tks-user-membership-add
          |_ tks-user-membership-del
 |_ tps
    |_ tps-activity
       |_ tps-activity-find
       |_ tps-activity-show
    |_ tps-audit
       |_ tps-audit-mod
       |_ tps-audit-show
    |_ tps-authenticator
       |_ tps-authenticator-add
       |_ tps-authenticator-find
       |_ tps-authenticator-mod
       |_ tps-authenticator-del
       |_ tps-authenticator-show
    |_ tps-cert
       |_ tps-cert-find
       |_ tps-cert-show
    |_ tps-config
       |_ tps-config-mod
       |_ tps-config-show
    |_ tps-connection
       |_ tps-connection-add
       |_ tps-connection-find
       |_ tps-connection-mod
       |_ tps-connection-del
       |_ tps-connection-show
    |_ tps-group
       |_ tps-group-find
       |_ tps-group-show
       |_ tps-group-add
       |_ tps-group-mod
       |_ tps-group-del
       |_ tps-group-member
          |_ tps-group-member-find
          |_ tps-group-member-show
          |_ tps-group-member-add
          |_ tps-group-member-del
    |_ tps-profile
       |_ tps-profile-add
       |_ tps-profile-find
       |_ tps-profile-mod
       |_ tps-profile-del
       |_ tps-profile-show
       |_ tps-profile-mapping
          |_ tps-profile-mapping-add
          |_ tps-profile-mapping-find
          |_ tps-profile-mapping-mod
          |_ tps-profile-mapping-del
          |_ tps-profile-mapping-show
    |_ tps-selftest
       |_ tps-selftest-find
       |_ tps-selftest-run
       |_ tps-selftest-show
    |_ tps-token
       |_ tps-token-add
       |_ tps-token-find
       |_ tps-token-mod
       |_ tps-token-del
       |_ tps-token-show
    |_ tps-user
       |_ tps-user-find
       |_ tps-user-show
       |_ tps-user-add
       |_ tps-user-mod
       |_ tps-user-del
       |_ tps-user-cert
          |_ tps-user-cert-find
          |_ tps-user-cert-show
          |_ tps-user-cert-add
          |_ tps-user-cert-del
       |_ tps-user-membership
          |_ tps-user-membership-find
          |_ tps-user-membership-add
          |_ tps-user-membership-del
 |_ user
    |_ user-find
    |_ user-show
    |_ user-add
    |_ user-mod
    |_ user-del
    |_ user-cert
       |_ user-cert-find
       |_ user-cert-show
       |_ user-cert-add
       |_ user-cert-del
    |_ user-membership
       |_ user-membership-find
       |_ user-membership-add
       |_ user-membership-del

NOTE: All commands should probably be alphabetized for consistency underneath their various tree structures.

Proposed milestone: 10.2 Backlog

pki-bot commented 4 years ago

Comment from edewata (@edewata) at 2014-04-23 23:53:01

This can be implemented by recursively iterating through the 'modules' map in the CLI. Each node in the above tree is a subclass of CLI and the 'modules' in each node contains the children of the node. The 'modules' is a LinkedHashMap, so the insertion order is preserved (see CLI.addModule() invocations). I'd suggest we maintain this order while displaying the tree (i.e. no need to re-sort) to be consistent with CLI.printHelp().

The code may look like this:

public class CLI {

    public void displayTree(int level) {

        // display node
        ...

        // display children
        for (CLI module : modules.values()) {
            module.displayTree(level + 1);
        }
    }
}
pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2014-04-29 00:01:00

Per CS/DS meeting of 04/28/2014 - 10.3.

pki-bot commented 4 years ago

Comment from mharmsen (@mharmsen) at 2017-02-27 13:59:10

Metadata Update from @mharmsen: