#49922 Displaying help of subcommands without specifying an instance name
Closed: wontfix 5 years ago by firstyear. Opened 5 years ago by mmuehlfeldrh.

Issue Description

dsidm, dsconf, dsctl have several subcommands. If you only want to display the --help output of subcommands, the utilities always force you to provide an instance name string.

However, for displaying the help of subcommands, the instance name is not uses (it also works if you set it to a random string). It would be helpful if users could display the help of subcommands without specifying an instance name string.

Package Version and Platform

389-Directory/1.4.0.15.20180821gitc393394f8 B2018.233.950

Steps to reproduce

For example:
1. dsidm account --help
2. dsctl db2bak --help
3. dsconf backend --help

Actual results

Either the help of the command itself is shown. For example:

# dsconf backend --help
usage: dsconf [-h] [-v] [-D BINDDN] [-b BASEDN] [-Z] [-j]
              instance
              {config,backend,directory_manager,schema,healthcheck,plugin,memberof,usn,rootdn,whoami,referint,automember,sasl,pwpolicy,localpwp,backup}
              ...

positional arguments:
  instance              The instance name OR the LDAP url to connect to, IE
                        localhost, ldap://mai.example.com:389
...

Or an error is shown. For example:

# dsconf backend import --help
usage: dsconf [-h] [-v] [-D BINDDN] [-b BASEDN] [-Z] [-j]
              instance
              {config,backend,directory_manager,schema,healthcheck,plugin,memberof,usn,rootdn,whoami,referint,automember,sasl,pwpolicy,localpwp,backup}
              ...
dsconf: error: invalid choice: 'import' (choose from 'config', 'backend', 'directory_manager', 'schema', 'healthcheck', 'plugin', 'memberof', 'usn', 'rootdn', 'whoami', 'referint', 'automember', 'sasl', 'pwpolicy', 'localpwp', 'backup')

Expected results

Displaying help of subcommands of dsconf, dsidm, and dsctl should work without speciying an instance name string. It's not used by the utilities in this situation.


Metadata Update from @mreynolds:
- Custom field component adjusted to None
- Custom field origin adjusted to None
- Custom field reviewstatus adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None
- Issue set to the milestone: 1.4.0

5 years ago

The problem is that arg parse is really opinionated, and it's always "prog inst command". It's going to be hard to seperate "okay, the inst is optional" because then the inst has to be after command, and the ux is about being able to go from "largest to smallest" concept, where you can backspace over small command parts on the tail.

So I actually think this may be impossible to achieve sorry :( :( :(

Metadata Update from @firstyear:
- Issue close_status updated to: wontfix
- Issue status updated to: Closed (was: Open)

5 years ago

But
dsconf backend --help
is accepted and produces output, so instance is not always required.

Wouldn't it al least be possible to extend the help functionality like

dsconf backend --help import
?

@lkrispen That works due to a weird design of argparse. If argparse sees "--help" at all, it skips the other checks and just displays help. So it's actually interpretting "backend" as the instance name here, and then it just never uses it because it shortcuts to the top level --help first.

To get real backend --help you would need dsconf something backend --help. Due to the design of argparse in python, there must be something in the spot of "something" else we won't get to the subcommand of "backend" to show it's help.

As a shortcut trick you can do: dsconf a backend --help

But this isn't exactly optimal.

I think in this case, this is probably what a manpage is useful for as a reference to all the commands, and --help is just for localised checks in a situation.

@lkrispen, would 'dsconf noinstance backend import --help' be acceptable ?

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/2981

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Login to comment on this ticket.

Metadata