From 352431eb6a389f92141995c67ca0bdd56cd5644f Mon Sep 17 00:00:00 2001 From: Massimiliano Giovagnoli Date: Wed, 23 Aug 2023 14:17:11 +0200 Subject: [PATCH] docs: update command doc generation Signed-off-by: Massimiliano Giovagnoli --- Makefile | 2 +- README.md | 12 ++---------- cmd/find/find.go | 9 +++++---- doc/doc.go => docs/gen.go | 7 ++++++- {doc => docs}/wfind.md | 1 - 5 files changed, 14 insertions(+), 17 deletions(-) rename doc/doc.go => docs/gen.go (82%) rename {doc => docs}/wfind.md (97%) diff --git a/Makefile b/Makefile index 0f34b69..7d79c6c 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ $(foreach bin,$(bins),\ .PHONY: doc doc: - @go run doc/doc.go + @go run docs/gen.go .PHONY: build build: diff --git a/README.md b/README.md index b33ae0e..f9dbd99 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # wfind: like find but for web sites -`wfind` (world wide web find) search for files in a web site directory hierarchy over HTTP and HTTPS, through HTML references. +`wfind` (world wide web find) search for files in a web site directory hierarchy over HTTP, through HTML references. The tool is inspired by GNU `find(1)` and `wget(1)`. @@ -10,15 +10,7 @@ The tool is inspired by GNU `find(1)` and `wget(1)`. wfind URL [flags] ``` -#### Options - -``` - -h, --help help for wfind - -n, --name string Base of file name (the path with the leading directories removed) pattern. - -r, --recursive Whether to examine entries recursing into directories. Disable to behave like GNU find -maxdepth=0 option. (default true) - -t, --type string The file type - -v, --verbose Enable verbosity to log all visited HTTP(s) files -``` +For details please read the CLI [documentation](./docs/wfind.md). ### In action diff --git a/cmd/find/find.go b/cmd/find/find.go index 8ddbe29..631121b 100644 --- a/cmd/find/find.go +++ b/cmd/find/find.go @@ -44,10 +44,11 @@ func NewCmd() *cobra.Command { } cmd := &cobra.Command{ - Use: "wfind URL", - Short: "Find folders and files in web sites using HTTP or HTTPS", - Args: cobra.MinimumNArgs(1), - RunE: o.Run, + Use: "wfind URL", + Short: "Find folders and files in web sites using HTTP or HTTPS", + DisableAutoGenTag: true, + Args: cobra.MinimumNArgs(1), + RunE: o.Run, } // General flags. diff --git a/doc/doc.go b/docs/gen.go similarity index 82% rename from doc/doc.go rename to docs/gen.go index 6da932a..8e96cb2 100644 --- a/doc/doc.go +++ b/docs/gen.go @@ -24,5 +24,10 @@ import ( ) func main() { - output.ExitOnErr(doc.GenMarkdownTree(find.NewCmd(), "./doc")) + output.ExitOnErr(doc.GenMarkdownTreeCustom( + find.NewCmd(), + "./docs", + func(s string) string { return "" }, + func(s string) string { return s }, + )) } diff --git a/doc/wfind.md b/docs/wfind.md similarity index 97% rename from doc/wfind.md rename to docs/wfind.md index 1eb6581..a3f5c42 100644 --- a/doc/wfind.md +++ b/docs/wfind.md @@ -24,4 +24,3 @@ wfind URL [flags] -v, --verbose Enable verbosity to log all visited HTTP(s) files ``` -###### Auto generated by spf13/cobra on 23-Aug-2023