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 c3a1a35 commit 4164c33Copy full SHA for 4164c33
builder.go
@@ -1,6 +1,7 @@
1
package cli
2
3
import (
4
+ "runtime/debug"
5
"slices"
6
"strings"
7
)
@@ -19,6 +20,17 @@ var (
19
20
errReqArgAfterOptional = "required positional arguments cannot come after optional ones"
21
22
23
+func New() CommandInfo {
24
+ info, ok := debug.ReadBuildInfo()
25
+ if !ok {
26
+ panic("failed to read build info")
27
+ }
28
+ lastSlash := strings.LastIndexByte(info.Path, '/')
29
+ modName := info.Path[lastSlash+1:]
30
+
31
+ return NewCmd(modName)
32
+}
33
34
func (c *CommandInfo) prepareAndValidate() {
35
// Add the default help option here as long as this
36
// command doesn't already have a help option.
0 commit comments