Commit graph

56 commits

Author SHA1 Message Date
Jim Schubert
b5bc3e3275 Merge branch 'main' into doc-slash-commands
* main: (39 commits)
  Add '--version' flag to Help output (#1707)
  Expose ValidateRequiredFlags and ValidateFlagGroups (#1760)
  Document option to hide the default completion cmd (#1779)
  ci: add workflow_dispatch (#1387)
  add missing license headers (#1809)
  ci: use action/setup-go's cache (#1783)
  Adjustments to documentation (#1656)
  Rename Powershell completion tests (#1803)
  Support for case-insensitive command names (#1802)
  Deprecate ExactValidArgs() and test combinations of args validators (#1643)
  Use correct stale action `exempt-` yaml keys (#1800)
  With go 1.18, we must use go install for a binary (#1726)
  Clarify SetContext documentation (#1748)
  ci: test on Golang 1.19 (#1782)
  fix: show flags that shadow parent persistent flag in child help (#1776)
  Update gopkg.in/yaml.v2 to gopkg.in/yaml.v3 (#1766)
  fix(bash-v2): activeHelp length check syntax (#1762)
  fix: correct command path in see_also for YAML doc (#1771)
  build(deps): bump github.com/inconshreveable/mousetrap (#1774)
  docs: add zitadel to the list (#1772)
  ...
2022-10-02 21:14:54 -04:00
Unai Martinez-Corral
6d978a911e
add missing license headers (#1809) 2022-09-16 07:55:56 -04:00
Tobias Klauser
dbf85f6104
Update gopkg.in/yaml.v2 to gopkg.in/yaml.v3 (#1766)
API v3 was released in 2019 [1]. Update from the v2 API, no changes to
the packages's use needed and no breaking changes expected.

[1] https://ubuntu.com/blog/api-v3-of-the-yaml-package-for-go-is-available
2022-08-13 16:18:46 -06:00
Zoran Regvart
7790bf97fd
fix: correct command path in see_also for YAML doc (#1771)
The `see_also` section for child commands would include only the name of
the commands. This adds the whole path, similar to how it's done for the
other documentation formats.
2022-08-13 17:31:45 -04:00
Andreas Deininger
ffa8860dbe
Change links from http:// to https:// (#1695) 2022-05-17 14:28:13 -04:00
Jim Schubert
0bfd1c113a yaml supports commands with slashes 2022-05-16 22:02:55 -04:00
Jim Schubert
a913e1fbab reStructuredText supports commands with slashes 2022-05-16 22:02:00 -04:00
Jim Schubert
385a6fe2ea Manpage supports commands with slashes 2022-05-16 22:00:33 -04:00
Jim Schubert
500d19e1c2 Markdown supports commands with slashes 2022-05-16 21:58:10 -04:00
Hugo
25f5bb5f97
Prefer ReplaceAll instead of Replace(..., -1) (#1530) 2022-05-14 14:10:36 -06:00
Sebastiaan van Stijn
2a5277810f
go.mod: cpuguy83/go-md2man/v2 v2.0.1 (#1460)
full diff: https://github.com/cpuguy83/go-md2man/compare/v2.0.0...v2.0.1

- Fix handling multiple definition descriptions
- Fix inline markup causing table cells to split
- Remove escaping tilde character (prevents tildes (`~`) from disappearing).
- Do not escape dash, underscore, and ampersand (prevents ampersands (`&`) from disappearing).
- Ignore unknown HTML tags to prevent noisy warnings

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-05 11:08:25 -06:00
Unai Martinez-Corral
652c755d37
Use golangci-lint (#1044)
Use golangci-lint. Repair warnings and errors resulting from linting.
2021-02-07 17:08:50 -07:00
John McBride
ff416ad438
Revert "Add the ability to specify a filePostpender in GenMarkdownTreeCustom (#1270)" (#1317)
This reverts commit 23a6174c7f.
2021-01-23 16:05:55 -07:00
Joon-Ho Son
23a6174c7f
Add the ability to specify a filePostpender in GenMarkdownTreeCustom (#1270) 2021-01-20 20:33:16 -07:00
Sascha Steinbiss
86f8bfd7fe
fix manpage building with new go-md2man (#1255)
This addresses #1049 by changing the format of the generated
Markdown input.
2020-10-18 12:59:26 -06:00
Marc Lopez Rubio
02a0d2fbc9
doc: GenMarkdown skip Synopsis on empty long cmd (#1207)
This patch modifies the GenMarkdownCustom to skip writing a Synopsis
header with the `cmd.Short` duplicated both before and after the header.

Instead, it only writes the `### Synopsis` header and the paragraph when
a `cmd.Long` has some kind of content in it.

Adds `TestGenMdDocWithNoLongOrSynopsis` as the test case.

Signed-off-by: Marc Lopez <marc5.12@outlook.com>
2020-08-26 09:18:51 -06:00
Felix Yan
a0b86e58f8
Correct a typo in doc/util.go (#1184) 2020-08-10 22:17:29 -06:00
Alessandro (Ale) Segala
ed7b60e298
YAML documentation contains "Usage" (#1037) 2020-06-15 16:51:03 -06:00
John McBride
e392f3204d
Man pages won't have auto gen tag when option is disabled (#1104)
* Man pages wont have  auto gen tag when option is disabled

- this addresses #741

* Add documentation for doc generation and a changelog
2020-04-29 11:15:55 -06:00
Stefano Guerrini
b04b5bfc50 substitute wrong word in md_docs (#998) 2019-12-02 08:04:30 -05:00
Peter Fern
77e4d5aecc Update md2man to v2.0.0 (#977)
Fixes #805
2019-10-19 16:17:41 -06:00
Aleksa Sarai
fe5e611709 doc: obey SOURCE_DATE_EPOCH with manpage generation (#735)
Previously if a cobra user didn't specify an explicit .Date header, the
current time would be included in all of the generated man pages each
time they were built. This causes an issue for reproducible builds,
since each re-build of a package that includes the man pages will have
different times listed in the man pages.

To fix this, add support for SOURCE_DATE_EPOCH (which is a standardised
packaging environment variable, designed to be used specifically for
this purpose[1]).

[1]: https://reproducible-builds.org/specs/source-date-epoch/

Signed-off-by: Aleksa Sarai <asarai@suse.de>
2018-10-21 10:11:14 -04:00
Pascal Dierich
ff0d02e855 fix typo in doc/man_docs.go (#732) 2018-08-20 13:45:24 -04:00
James DeFelice
0ab5b6bcfc doc: hide hidden parent flags (#686)
* fixes #685
2018-04-24 12:15:12 -04:00
Allen Sun
3a5f27b046 doc: Add a necessary blank line after SEE ALSO (#592)
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-12-04 11:43:02 +01:00
Allen Sun
45a52e208c doc: Remove one additional blank line after Synopsis (#591)
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-12-04 10:21:50 +01:00
Albert Nigmatzianov
2da4a54c5c Improve tests in doc/ 2017-11-09 07:56:43 +01:00
Shahidh K Muhammed
419e0f8d51 doc: add ReST doc generation (#537) 2017-10-07 19:39:47 +02:00
Albert Nigmatzianov
ca57f0f5db doc: Ad help flag and cmd when generating docs 2017-05-20 19:28:06 +02:00
Albert Nigmatzianov
6bfe2ba1a2 doc: Add docs 2017-05-09 11:14:48 +02:00
Albert Nigmatzianov
6dd90846ba doc: Use w.Write instead of fmt in yaml_docs
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenYamlToFile-4         62488         61622         -1.39%

benchmark                        old allocs     new allocs     delta
BenchmarkGenYamlToFile-4         121            120            -0.83%

benchmark                        old bytes     new bytes     delta
BenchmarkGenYamlToFile-4         26706         26280         -1.60%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov
97af803f3b doc: Cleanup md_docs
Performance gain:
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenMarkdownToFile-4     23096         10295         -55.43%

benchmark                        old allocs     new allocs     delta
BenchmarkGenMarkdownToFile-4     47             48             +2.13%

benchmark                        old bytes     new bytes     delta
BenchmarkGenMarkdownToFile-4     1984          2832          +42.74%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov
de484eefb4 doc: Refactor man docs
Performance impact (very strange):
benchmark                        old ns/op     new ns/op     delta
BenchmarkGenManToFile-4          30037         29001         -3.45%

benchmark                        old allocs     new allocs     delta
BenchmarkGenManToFile-4          77             89             +15.58%

benchmark                        old bytes     new bytes     delta
BenchmarkGenManToFile-4          9075          9651          +6.35%
2017-04-26 21:30:17 +02:00
Albert Nigmatzianov
f95d58bdf3 Fix #401 (#402)
* doc: Add and edit docs

* doc: Add tests
2017-04-19 14:39:58 +02:00
Albert Nigmatzianov
6421115516 doc: Fix govet complaints (#408) 2017-04-01 15:45:39 -05:00
Albert Nigmatzianov
0960ff7fa9 Rename IsHelpCommand to IsAdditionalHelpTopicCommand (#398)
Fixes #393
2017-03-09 10:37:15 -05:00
French Ben
35136c09d8 Added support for yaml ouptut in docs gen (#380)
Signed-off-by: French Ben <frenchben@docker.com>
2017-01-30 16:45:31 -05:00
Raphael 'kena' Poss
1dd5ff2e11 Make SEE ALSO references and generated file names agree with each other. 2016-12-29 00:59:22 -07:00
Julien Kassar
6b74a60562 Update doc/man_docs.md (#363) 2016-11-15 09:16:05 -05:00
Daniel Nephin
67feb8173c Add support for setting a function to handle flag parsing errors.
The default pflag error is to only print the bad flag. This enables an application
to include a usage message or other details about the error.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-10-10 10:56:48 -04:00
Chris Broadfoot
d1371ecdb4 gofmt, govet, run those in Travis, add 1.7 2016-08-23 13:30:43 -07:00
Daniel Nephin
e291587027 Cretea a new GenManTree function that takes an options struct.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-21 14:47:14 -04:00
Daniel Nephin
97206b3170 Use the correct man page section for the filename
Also make header mutation cleaner.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-21 14:30:54 -04:00
Daniel Nephin
112c7dca3a Hide deprecated shorthand flags in man page generation. 2016-06-21 14:30:26 -04:00
Daniel Nephin
29c0a1f42e Use the correct UseLine for the man page synposis.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2016-06-20 17:27:41 -04:00
joe2far
719241171d Fixed typos in README and docstring 2016-06-07 11:50:48 +01:00
Ian Walter
a0bd6c17b3 Fixing golint warnings
* 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
2016-03-31 09:53:34 -04:00
Garth Kidd
57f473263e Add explicit doc.GenMan SEE ALSO test covering #229 2016-01-21 12:12:26 +11:00
Garth Kidd
cb8496d6b2 Ensure SEE ALSO list has no leading comma, fixing #229 2016-01-21 12:11:56 +11:00
Garth Kidd
356750645f Update doc generation examples. Fixes #227. 2016-01-17 11:29:42 +11:00