We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 983d6a9 commit 02119dfCopy full SHA for 02119df
internal/command/root/root.go
@@ -3,6 +3,9 @@ package root
3
4
import (
5
"context"
6
+ "log"
7
+ "os"
8
+ "path/filepath"
9
10
"github.com/kr/text"
11
"github.com/olekukonko/tablewriter"
@@ -77,7 +80,16 @@ func New() *cobra.Command {
77
80
short = "The Fly.io command line interface"
78
81
)
79
82
- root := command.New("fly", short, long, run)
83
+ exePath, err := os.Executable()
84
+ var exe string
85
+ if err != nil {
86
+ log.Printf("WARN: failed to find executable, error=%q", err)
87
+ exe = "fly"
88
+ } else {
89
+ exe = filepath.Base(exePath)
90
+ }
91
+
92
+ root := command.New(exe, short, long, run)
93
root.PersistentPreRun = func(cmd *cobra.Command, args []string) {
94
cmd.SilenceUsage = true
95
cmd.SilenceErrors = true
0 commit comments