diff --git a/README.md b/README.md index bb704d3..5d92ef1 100644 --- a/README.md +++ b/README.md @@ -8,39 +8,40 @@ -1. [Introduction](#introduction) -1. [Help](#help) - 1. [Help as a user of a Kong application](#help-as-a-user-of-a-kong-application) - 1. [Defining help in Kong](#defining-help-in-kong) - 1. [Showing the _command_'s detailed help](#showing-the-commands-detailed-help) - 1. [Showing an _argument_'s detailed help](#showing-an-arguments-detailed-help) - 1. [Showing a _flag_'s detailed help](#showing-a-flags-detailed-help) -1. [Command handling](#command-handling) - 1. [Switch on the command string](#switch-on-the-command-string) - 1. [Attach a `Run(...) error` method to each command](#attach-a-run-error-method-to-each-command) -1. [Hooks: BeforeResolve\(\), BeforeApply\(\), AfterApply\(\) and the Bind\(\) option](#hooks-beforeresolve-beforeapply-afterapply-and-the-bind-option) -1. [Flags](#flags) -1. [Commands and sub-commands](#commands-and-sub-commands) -1. [Branching positional arguments](#branching-positional-arguments) -1. [Positional arguments](#positional-arguments) -1. [Slices](#slices) -1. [Maps](#maps) -1. [Custom named decoders](#custom-named-decoders) -1. [Supported field types](#supported-field-types) -1. [Custom decoders \(mappers\)](#custom-decoders-mappers) -1. [Supported tags](#supported-tags) -1. [Plugins](#plugins) -1. [Dynamic Commands](#dynamic-commands) -1. [Variable interpolation](#variable-interpolation) -1. [Validation](#validation) -1. [Modifying Kong's behaviour](#modifying-kongs-behaviour) - 1. [`Name(help)` and `Description(help)` - set the application name description](#namehelp-and-descriptionhelp---set-the-application-name-description) - 1. [`Configuration(loader, paths...)` - load defaults from configuration files](#configurationloader-paths---load-defaults-from-configuration-files) - 1. [`Resolver(...)` - support for default values from external sources](#resolver---support-for-default-values-from-external-sources) - 1. [`*Mapper(...)` - customising how the command-line is mapped to Go values](#mapper---customising-how-the-command-line-is-mapped-to-go-values) - 1. [`ConfigureHelp(HelpOptions)` and `Help(HelpFunc)` - customising help](#configurehelphelpoptions-and-helphelpfunc---customising-help) - 1. [`Bind(...)` - bind values for callback hooks and Run\(\) methods](#bind---bind-values-for-callback-hooks-and-run-methods) - 1. [Other options](#other-options) +- [Kong is a command-line parser for Go](#kong-is-a-command-line-parser-for-go) + - [Introduction](#introduction) + - [Help](#help) + - [Help as a user of a Kong application](#help-as-a-user-of-a-kong-application) + - [Defining help in Kong](#defining-help-in-kong) + - [Showing the _command_'s detailed help](#showing-the-commands-detailed-help) + - [Showing an _argument_'s detailed help](#showing-an-arguments-detailed-help) + - [Command handling](#command-handling) + - [Switch on the command string](#switch-on-the-command-string) + - [Attach a `Run(...) error` method to each command](#attach-a-run-error-method-to-each-command) + - [Hooks: BeforeResolve(), BeforeApply(), AfterApply() and the Bind() option](#hooks-beforeresolve-beforeapply-afterapply-and-the-bind-option) + - [Flags](#flags) + - [Commands and sub-commands](#commands-and-sub-commands) + - [Branching positional arguments](#branching-positional-arguments) + - [Positional arguments](#positional-arguments) + - [Slices](#slices) + - [Maps](#maps) + - [Nested data structure](#nested-data-structure) + - [Custom named decoders](#custom-named-decoders) + - [Supported field types](#supported-field-types) + - [Custom decoders (mappers)](#custom-decoders-mappers) + - [Supported tags](#supported-tags) + - [Plugins](#plugins) + - [Dynamic Commands](#dynamic-commands) + - [Variable interpolation](#variable-interpolation) + - [Validation](#validation) + - [Modifying Kong's behaviour](#modifying-kongs-behaviour) + - [`Name(help)` and `Description(help)` - set the application name description](#namehelp-and-descriptionhelp---set-the-application-name-description) + - [`Configuration(loader, paths...)` - load defaults from configuration files](#configurationloader-paths---load-defaults-from-configuration-files) + - [`Resolver(...)` - support for default values from external sources](#resolver---support-for-default-values-from-external-sources) + - [`*Mapper(...)` - customising how the command-line is mapped to Go values](#mapper---customising-how-the-command-line-is-mapped-to-go-values) + - [`ConfigureHelp(HelpOptions)` and `Help(HelpFunc)` - customising help](#configurehelphelpoptions-and-helphelpfunc---customising-help) + - [`Bind(...)` - bind values for callback hooks and Run() methods](#bind---bind-values-for-callback-hooks-and-run-methods) + - [Other options](#other-options) @@ -134,7 +135,7 @@ Help is automatically generated from the command-line structure itself, including `help:""` and other tags. [Variables](#variable-interpolation) will also be interpolated into the help string. -Finally, any command, argument, or flag type implementing the interface +Finally, any command, or argument type implementing the interface `Help() string` will have this function called to retrieve more detail to augment the help tag. This allows for much more descriptive text than can fit in Go tags. [See _examples/shell/help](./_examples/shell/help) @@ -193,13 +194,6 @@ Flags: --flag Regular flag help ``` -#### Showing a _flag_'s detailed help - -> **TODO** (not known how to elicit this behaviour) - -Neither `go run ./main.go --help --flag` nor `go run ./main.go --flag --help` appear to work - - ## Command handling There are two ways to handle commands in Kong.