File tree Expand file tree Collapse file tree 4 files changed +15
-30
lines changed Expand file tree Collapse file tree 4 files changed +15
-30
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ import (
1212 "github.com/spf13/cobra/doc"
1313)
1414
15- var isDocsBuild = true
15+ const DispatchCmdLong = "This is the main command for Dispatch CLI. Add a subcommand to make it useful."
16+
17+ const RunExampleText = "```\n dispatch run [options] -- <command>\n ```"
1618
1719func generateDocs (cmd * cobra.Command , title string ) {
1820 cmd .DisableAutoGenTag = true
Original file line number Diff line number Diff line change @@ -4,7 +4,16 @@ package cli
44
55import "github.com/spf13/cobra"
66
7- var isDocsBuild = false
7+ const DispatchCmdLong = `Welcome to Dispatch!
8+
9+ To get started, use the login command to authenticate with Dispatch or create an account.
10+
11+ Documentation: https://docs.dispatch.run
12+ Discord: https://dispatch.run/discord
13+ Support: support@dispatch.run
14+ `
15+
16+ const RunExampleText = " dispatch run [options] -- <command>"
817
918func generateDocs (_ * cobra.Command , _ string ) {
1019 // do nothing if the build tag "docs" is not set
Original file line number Diff line number Diff line change @@ -6,29 +6,11 @@ import (
66 "github.com/spf13/cobra"
77)
88
9- var (
10- DispatchCmdLong = `Welcome to Dispatch!
11-
12- To get started, use the login command to authenticate with Dispatch or create an account.
13-
14- Documentation: https://docs.dispatch.run
15- Discord: https://dispatch.run/discord
16- Support: support@dispatch.run
17- `
18- )
19-
20- var mainCommandText string
21-
229func createMainCommand () * cobra.Command {
23- if isDocsBuild {
24- mainCommandText = "This is the main command for Dispatch CLI. Add a subcommand to make it useful."
25- } else {
26- mainCommandText = DispatchCmdLong
27- }
2810 cmd := & cobra.Command {
2911 Version : version (),
3012 Use : "dispatch" ,
31- Long : mainCommandText ,
13+ Long : DispatchCmdLong ,
3214 Short : "Main command for Dispatch CLI" ,
3315 PersistentPreRunE : func (cmd * cobra.Command , args []string ) error {
3416 return loadEnvFromFile (DotEnvFilePath )
Original file line number Diff line number Diff line change 5656 logPrefixSeparatorStyle = lipgloss .NewStyle ().Foreground (grayColor )
5757)
5858
59- var runExampleText string
60-
6159func runCommand () * cobra.Command {
62- if isDocsBuild {
63- runExampleText = "```\n dispatch run [options] -- <command>\n ```"
64- } else {
65- runExampleText = " dispatch run [options] -- <command>"
66- }
67-
6860 cmd := & cobra.Command {
6961 Use : "run" ,
7062 Short : "Run a Dispatch application" ,
@@ -73,7 +65,7 @@ func runCommand() *cobra.Command {
7365The command to start the local application endpoint should be
7466specified after the run command and its options:
7567
76- ` + runExampleText + `
68+ ` + RunExampleText + `
7769
7870Dispatch spawns the local application endpoint and then dispatches
7971function calls to it continuously.
You can’t perform that action at this time.
0 commit comments