-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
command help text formats #301
Comments
thank you for concretizing this |
@mappum here's the // HelpText is a set of strings used to generate command help text. The help
// text follows formats similar to man pages, but not exactly the same.
type HelpText struct {
// required
Tagline string // used in <cmd usage>
ShortDescription string // used in DESCRIPTION
// optional - whole section overrides
Usage string // overrides USAGE section
LongDescription string // overrides DESCRIPTION section
Options string // overrides OPTIONS section
Arguments string // overrides ARGUMENTS section
Subcommands string // overrides SUBCOMMANDS section
}
// Command is a runnable command, with input arguments and options (flags).
// It can also have Subcommands, to group units of work into sets.
type Command struct {
Options []Option
Arguments []Argument
Run Function
Marshallers map[EncodingType]Marshaller
Type interface{}
Subcommands map[string]*Command
Help HelpText
} |
What is the format of data in Type? |
I think |
Described in precise terms 0915ab1 // Type describes the type of the output of the Command's Run Function.
// Precisely, the value of Type is an instance of the return type of the
// Run Function.
//
// ie. If command Run returns &Block{}, then Command.Type == &Block{} |
maybe it should be a reflect.Type then? |
@whyrusleeping i think it's not a basic type, I think it can be more complicated? see core/commands2/add.go |
As of e501180, most of this is done. Remaining work is moving the different text fields into the |
Finished as of 163a8a3 |
thanks! |
👏 |
defer dialqueue action until initial peers have been added
Use the new formats from https://etherpad.mozilla.org/6aUpYEUPHK
Each command will have a
HelpText
object:NOTE: when overriding a section, user MUST still supply text for overridden parts, as they may be used elsewhere.
Examples:
The help output will be one of two different "pages":
ShortHelp
- meant to be shown on errors, or with -hLongHelp
- meant to be shown with --help oripfs help <cmd>
These are rendered using the following tokens:
And the following formats.
Note:
?
means the entire section can be omitted if empty@
means the section heading is silent (not shown)LongHelp:
ShortHelp:
The text was updated successfully, but these errors were encountered: