You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add cli.Execute() that owns all error dispatch (sentinels, flag errors,
default). Silence Cobra's built-in error/usage printing so Execute has
full control. Unexport FlagError and remove HandleError/NewFlagError —
flag wrapping is now internal to Init via SetFlagErrorFunc.
Modernize across packages: interface{} → any, os.IsNotExist →
errors.Is(fs.ErrNotExist), sort.Slice → slices.SortFunc. Update
migration guide and README to document cli.Execute.
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@
6
6
7
7
The standard way to build raystack services and CLIs.
8
8
9
-
Salt provides `app.Run()` for services and `cli.Init()` for command-line tools, along with the building blocks they use: configuration, middleware, terminal output, and more.
9
+
Salt provides `app.Run()` for services and `cli.Init()`/ `cli.Execute()`for command-line tools, along with the building blocks they use: configuration, middleware, terminal output, and more.
10
10
11
11
## Quick start
12
12
@@ -57,11 +57,11 @@ func main() {
57
57
cli.Version("0.1.0", "raystack/frontier"),
58
58
)
59
59
60
-
rootCmd.Execute()
60
+
cli.Execute(rootCmd)
61
61
}
62
62
```
63
63
64
-
Help, shell completion, and reference docs added automatically. Commands access shared output via `cli.Output(cmd)`.
64
+
`Init` adds help, shell completion, reference docs, and silences Cobra's default error output. `Execute` runs the command and handles all errors with proper exit codes. Commands access shared output via `cli.Output(cmd)`.
0 commit comments