Skip to content

Commit 6b9a85e

Browse files
committed
Move banner call
This gives a little more flexability, and it also handles the issue where banner was hijacking the help flags. Fixes #75 Signed-off-by: Matt Stratton <[email protected]>
1 parent 9f50fc6 commit 6b9a85e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cmd/root.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@
33
package cmd
44

55
import (
6+
"bytes"
67
"fmt"
78
"os"
89
"strings"
910

11+
"github.com/dimiro1/banner"
12+
"github.com/mattn/go-colorable"
1013
"github.com/spf13/cobra"
1114
"github.com/spf13/viper"
1215
)
1316

17+
var myBanner = `
18+
19+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
20+
|d|e|v|o|p|s|d|a|y|s|-|c|l|i|
21+
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
22+
23+
`
24+
1425
// webdir is the path to the source files for the Hugo website
1526
var webdir = setWebdir()
1627

@@ -52,6 +63,10 @@ func Execute() {
5263

5364
func init() {
5465
cobra.OnInitialize(initConfig)
66+
isEnabled := true
67+
isColorEnabled := true
68+
banner.Init(colorable.NewColorableStdout(), isEnabled, isColorEnabled, bytes.NewBufferString(myBanner))
69+
5570
RootCmd.PersistentFlags().BoolVarP(&Debug, "debug", "d", false, "enable debug mode")
5671

5772
}

main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33

44
import (
55
"github.com/devopsdays/devopsdays-cli/cmd"
6-
_ "github.com/dimiro1/banner/autoload"
76
)
87

98
func main() {

0 commit comments

Comments
 (0)