-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Change Arguments and Flags.
BREAKING CHANGE: Change in API.
- Loading branch information
1 parent
7bcfe05
commit 3c7bd20
Showing
7 changed files
with
109 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
Copyright © 2024 Lukasz Lobocki | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
"github.com/spf13/cobra/doc" | ||
) | ||
|
||
// markdownDocsCmd represents the markdownDocs command | ||
var markdownDocsCmd = &cobra.Command{ | ||
Long: ` | ||
Generate markdown docs for the entire command tree.`, | ||
Short: "Generate markdown docs.", | ||
DisableFlagsInUseLine: true, | ||
Use: `markdownDocs <PATH> [flags] | ||
Arguments: | ||
PATH location for the result`, | ||
|
||
Aliases: []string{"markdowndocs"}, | ||
|
||
Args: cobra.ExactArgs(1), | ||
|
||
Example: ` step-badger markdownDocs ~/tmp`, | ||
|
||
Hidden: true, // Hide command from the tree. | ||
|
||
Run: func(cmd *cobra.Command, args []string) { | ||
exportMarkdownMain(args) | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(markdownDocsCmd) | ||
|
||
// Hide help command. | ||
markdownDocsCmd.SetHelpCommand(&cobra.Command{Hidden: true}) | ||
|
||
//Do not sort flags. | ||
markdownDocsCmd.Flags().SortFlags = false | ||
} | ||
|
||
func exportMarkdownMain(args []string) { | ||
|
||
checkLogginglevel(args) | ||
|
||
err := doc.GenMarkdownTree(rootCmd, args[0]) | ||
if err != nil { | ||
logError.Fatalln(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters