aboutsummaryrefslogtreecommitdiffstats
path: root/internal
diff options
context:
space:
mode:
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))
+}