aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-02-07 21:45:02 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2024-02-07 21:45:02 -0500
commitab25e363ed49d234f347d78b51c5dc07f6eebfa7 (patch)
tree67f975faa2f9305ba0d2b89f649106c088047456 /internal
parentFix return value for console outputter output and error funcs (diff)
downloadcli-ab25e363ed49d234f347d78b51c5dc07f6eebfa7.zip
Move pkg/cli to internal/cli
Diffstat (limited to 'internal')
-rw-r--r--internal/cli/cli.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/internal/cli/cli.go b/internal/cli/cli.go
new file mode 100644
index 0000000..29a10ff
--- /dev/null
+++ b/internal/cli/cli.go
@@ -0,0 +1,25 @@
+package cli
+
+import (
+ "context"
+ "flag"
+
+ "github.com/eugenetriguba/bolt/internal/commands"
+ "github.com/google/subcommands"
+)
+
+// Run runs the Bolt CLI and returns the exit code.
+func Run() int {
+ subcommands.Register(subcommands.HelpCommand(), "")
+ subcommands.Register(subcommands.FlagsCommand(), "")
+ subcommands.Register(subcommands.CommandsCommand(), "")
+ subcommands.Register(&commands.VersionCmd{}, "")
+ subcommands.Register(&commands.NewCmd{}, "")
+ subcommands.Register(&commands.UpCmd{}, "")
+ subcommands.Register(&commands.DownCmd{}, "")
+ subcommands.Register(&commands.StatusCmd{}, "")
+
+ flag.Parse()
+ ctx := context.Background()
+ return int(subcommands.Execute(ctx))
+}