lib: Split off the CLI portions into a separate package

This cleans things up a bit more and forces the lib package to not
contain any accidental CLI parsing code.
This commit is contained in:
James Shubin
2024-02-22 19:50:44 -05:00
parent 70b5ed7067
commit abe3e0e7a5
8 changed files with 47 additions and 30 deletions

15
main.go
View File

@@ -22,7 +22,7 @@ import (
"fmt"
"os"
mgmt "github.com/purpleidea/mgmt/lib"
"github.com/purpleidea/mgmt/cli"
"go.etcd.io/etcd/server/v3/etcdmain"
)
@@ -55,17 +55,16 @@ func main() {
return // for safety
}
flags := mgmt.Flags{
Debug: Debug,
Verbose: Verbose,
}
cliArgs := &mgmt.CLIArgs{
cliArgs := &cli.CLIArgs{
Program: program,
Version: version,
Copying: copying,
Flags: flags,
Flags: cli.Flags{
Debug: Debug,
Verbose: Verbose,
},
}
if err := mgmt.CLI(cliArgs); err != nil {
if err := cli.CLI(cliArgs); err != nil {
fmt.Println(err)
os.Exit(1)
return