cmd/loop: factor newRootCommand

This commit is contained in:
Boris Nagaev 2026-02-04 16:29:24 -05:00
parent 74c7274b03
commit 3e9a99dd55
No known key found for this signature in database

View file

@ -201,7 +201,15 @@ func fatal(err error) {
}
func main() {
rootCmd := &cli.Command{
rootCmd := newRootCommand()
if err := rootCmd.Run(context.Background(), os.Args); err != nil {
fatal(err)
}
}
// newRootCommand constructs the CLI root command for loop.
func newRootCommand() *cli.Command {
return &cli.Command{
Name: "loop",
Usage: "control plane for your loopd",
Version: loop.RichVersion(),
@ -222,10 +230,6 @@ func main() {
return cli.ShowRootCommandHelp(cmd)
},
}
if err := rootCmd.Run(context.Background(), os.Args); err != nil {
fatal(err)
}
}
// getClient establishes a SwapClient RPC connection and returns the client and