2026-07-03 06:01:34 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
|
|
import (
|
2026-07-04 00:59:32 +00:00
|
|
|
"context"
|
2026-07-03 06:01:34 +00:00
|
|
|
"fmt"
|
|
|
|
|
"io"
|
2026-07-03 17:01:24 +00:00
|
|
|
|
2026-08-25 01:55:09 +00:00
|
|
|
"gitea.maximumdirect.net/eric/notarius/internal/buildinfo"
|
2026-11-21 22:59:46 +00:00
|
|
|
"go.maximumdirect.net/commandkit"
|
2026-07-03 06:01:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Run(args []string, stdout, stderr io.Writer) int {
|
2026-07-03 17:01:24 +00:00
|
|
|
return RunWithOptions(args, stdout, stderr, Options{})
|
|
|
|
|
}
|
|
|
|
|
|
2026-11-22 03:51:08 +00:00
|
|
|
func RunWithOptions(args []string, stdout, stderr io.Writer, options Options) int {
|
2026-11-21 22:59:46 +00:00
|
|
|
version, err := buildinfo.Version()
|
2026-07-17 04:53:09 +00:00
|
|
|
if err != nil {
|
|
|
|
|
fmt.Fprintf(stderr, "notarius: %v\n", err)
|
|
|
|
|
return 1
|
|
|
|
|
}
|
2026-11-22 03:51:08 +00:00
|
|
|
app, err := NewApplication(version, options)
|
2026-11-21 22:59:46 +00:00
|
|
|
if err != nil {
|
|
|
|
|
fmt.Fprintf(stderr, "notarius: %v\n", err)
|
|
|
|
|
return 1
|
2026-07-03 06:01:34 +00:00
|
|
|
}
|
2026-11-21 22:59:46 +00:00
|
|
|
return app.Execute(context.Background(), args, commandkit.Streams{Out: stdout, Err: stderr}).Status
|
2026-07-03 06:01:34 +00:00
|
|
|
}
|