Commit graph

12 commits

Author SHA1 Message Date
Nir Soffer
511af59cb3
Replace deprecated ioutil usage (#2181)
Fixing golangci-lint errors[1]:

    Error: SA1019: "io/ioutil" has been deprecated since Go 1.19: As of
    Go 1.16, the same functionality is now provided by package [io] or
    package [os], and those implementations should be preferred in new
    code. See the specific function documentation for details.
    (staticcheck)

[1] https://github.com/spf13/cobra/actions/runs/10535452454/job/29194442289?pr=2180
2024-08-24 07:05:26 -04:00
Unai Martinez-Corral
9e6b58afc7
update copyright year (#1927) 2023-03-05 21:28:31 -05:00
Unai Martinez-Corral
6d978a911e
add missing license headers (#1809) 2022-09-16 07:55:56 -04: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
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
James DeFelice
0ab5b6bcfc doc: hide hidden parent flags (#686)
* fixes #685
2018-04-24 12:15:12 -04:00
Albert Nigmatzianov
2da4a54c5c Improve tests in doc/ 2017-11-09 07:56:43 +01: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
f95d58bdf3 Fix #401 (#402)
* doc: Add and edit docs

* doc: Add tests
2017-04-19 14:39:58 +02:00
Daniel Martí
eb5040e69e Treat write errors in markdown doc generation
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.
2016-01-06 12:21:04 +01:00
Frank Schroeder
b3f29e98e6 Issue #195: Move doc generation into separate pkg
* Move man_docs and md_docs into new doc pkg
* Replace *bytes.Buffer with io.Writer
* Replace c == cmd.helpCommand with c.IsHelpCommand()
* Remove redundant len(children) == 0 check in HasSeeAlso
* Duplicate test setup for doc generation
2015-12-24 09:01:59 -05:00
Renamed from md_docs_test.go (Browse further)