From ab25e363ed49d234f347d78b51c5dc07f6eebfa7 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Wed, 7 Feb 2024 21:45:02 -0500 Subject: Move pkg/cli to internal/cli --- internal/cli/cli.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 internal/cli/cli.go (limited to 'internal') 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)) +} -- cgit v1.2.3