refactor: move making app struct to construct func
continuous-integration/drone/push Build is passing Details

makes the code cleaner and easier to grab the app struct for testing
This commit is contained in:
Roxie Gibson 2021-10-20 09:45:38 +01:00
parent 8703370785
commit 96ccadc70f
Signed by untrusted user: roxxers
GPG Key ID: 5D0140EDEE123F4D
1 changed files with 7 additions and 2 deletions

View File

@ -41,8 +41,7 @@ var DebugFlag = &cli.BoolFlag{
Usage: "Show DEBUG messages",
}
// RunApp runs CLI abra app.
func RunApp(version, commit string) {
func newAbraApp(version, commit string) *cli.App {
app := &cli.App{
Name: "abra",
Usage: `The Co-op Cloud command-line utility belt 🎩🐇
@ -108,6 +107,12 @@ func RunApp(version, commit string) {
return nil
}
return app
}
// RunApp runs CLI abra app.
func RunApp(version, commit string) {
app := newAbraApp(version, commit)
if err := app.Run(os.Args); err != nil {
logrus.Fatal(err)