If a command has one flag which is hidden, it should not, for
instance, show the `Flags: ` heading. Likewise there are other
items in the help template which should respect hidden/deprecated
state.
* Refactoring code that unnecessarily declares a map before making it.
* Cleaning up gpl3 formatting to match other licenses.
* Adding functionality that allows specifying custom license header
and text in cobra config.
* Using license header and text as templates so that they can use
template variables (for custom and gpl3 licenses).
* Adding ability to specify no license.
* Adding custom license example to README.
* Moving final return outside of if-else
* Removing type declarations that Go can infer from values
* Cleaning up some existing comments
* Changing snake_case variables to camelCase
The use of "declare -A flaghash" (associative array) was introduced
in PR #205, which works perfectly for Bash 4.x, but OS X insists on
shipping a very outdated Bash 3.2.x.
This patch hides the "bash: declare: -A: invalid option" error message
and allows the bash completion script to continue gracefully on
OS X, albeit without the benefit of the new feature in PR #205.
Fixes#240
Just like the last commit, but now for manpages.
genMan still works with a buffer and returns []byte instead of working
directly with an io.Writer. This is because, in turn, md2man takes byte
slices instead of readers and writers.
Wrapping genMan around a writer is unnecessary especially since it's not
an exported function, and also because we'd still need a buffer to get
the output bytes.
This code was already using io.Writer, but was completely ignoring write
errors.
The most worrying part is how GenMarkdownTreeCustom used an unnecessary
buffer to then dump all of its contents on a file, and instead of
returning an error on file creation/writing, it would just exit the
entire program.
Since the switch from *bytes.Buffer to io.Writer, errors can no longer
be ignored. Also makes the reuse of GenBashCompletion in
GenBashCompletionFile without a buffer treat errors properly again.