cli: Refactor even more code out of cli package

Quite honestly, I'm trying to clean things up, and removing anything
non-consequential will help!
This commit is contained in:
James Shubin
2024-02-25 19:03:14 -05:00
parent c37ff3efce
commit 71c54ab212
8 changed files with 36 additions and 25 deletions

View File

@@ -23,6 +23,7 @@ import (
"log"
"os"
cliUtil "github.com/purpleidea/mgmt/cli/util"
"github.com/purpleidea/mgmt/etcd/client"
"github.com/purpleidea/mgmt/etcd/deployer"
etcdfs "github.com/purpleidea/mgmt/etcd/fs"
@@ -43,11 +44,11 @@ func deploy(c *cli.Context, name string, gapiObj gapi.GAPI) error {
return fmt.Errorf("could not get cli context")
}
program, version := safeProgram(c.App.Name), c.App.Version
var flags Flags
program, version := cliUtil.SafeProgram(c.App.Name), c.App.Version
var flags cliUtil.Flags
var debug bool
if val, exists := c.App.Metadata["flags"]; exists {
if f, ok := val.(Flags); ok {
if f, ok := val.(cliUtil.Flags); ok {
flags = f
debug = flags.Debug
}
@@ -56,7 +57,7 @@ func deploy(c *cli.Context, name string, gapiObj gapi.GAPI) error {
log.Printf("deploy: "+format, v...)
}
hello(program, version, flags) // say hello!
cliUtil.Hello(program, version, flags) // say hello!
defer Logf("goodbye!")
var hash, pHash string