Skip to content

Commit bc398ae

Browse files
committed
cleanup
1 parent 4945a26 commit bc398ae

File tree

4 files changed

+15
-30
lines changed

4 files changed

+15
-30
lines changed

cli/generate_docs.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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 = "```\ndispatch run [options] -- <command>\n```"
1618

1719
func generateDocs(cmd *cobra.Command, title string) {
1820
cmd.DisableAutoGenTag = true

cli/generate_docs_default.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ package cli
44

55
import "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

918
func generateDocs(_ *cobra.Command, _ string) {
1019
// do nothing if the build tag "docs" is not set

cli/main.go

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff 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-
229
func 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)

cli/run.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,7 @@ var (
5656
logPrefixSeparatorStyle = lipgloss.NewStyle().Foreground(grayColor)
5757
)
5858

59-
var runExampleText string
60-
6159
func runCommand() *cobra.Command {
62-
if isDocsBuild {
63-
runExampleText = "```\ndispatch 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 {
7365
The command to start the local application endpoint should be
7466
specified after the run command and its options:
7567
76-
`+runExampleText+`
68+
`+RunExampleText+`
7769
7870
Dispatch spawns the local application endpoint and then dispatches
7971
function calls to it continuously.

0 commit comments

Comments
 (0)