cmd icon indicating copy to clipboard operation
cmd copied to clipboard

Make documentation an adaptor rather than implicit.

Open SimonRichardson opened this issue 2 years ago • 0 comments

This is another breaking change.

The documentation command should not be instantiated for every command supercommand. Every binary or sub-super command that implements the super command now has a documentation command. This includes things like jujud, container-agent, etc.

Instead, a documentation command should be added to the super command base as an adapter. Ideally, the documentation command should be in a sub-package, so that it can be used in isolation.

An example of this should be:

waitFor := cmd.NewSuperCommand(cmd.SuperCommandParams{
	Name:        "wait-for",
	UsagePrefix: "juju",
	Doc:         waitForDoc,
	Purpose:     "Wait for an entity to reach a specified state.",
	Documentation: documentation.NewMarkdown(),
})

If there is no documentation, it doesn't do anything. This is purely additive.

SimonRichardson avatar Aug 14 '23 09:08 SimonRichardson