blob: 336e1d64ea17c1b6aebc90aa7378128cc3b8be4f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
// Root Cobra command: vespa
// author: bratseth
package cmd
import (
"log"
"os"
"github.com/logrusorgru/aurora"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"github.com/spf13/cobra"
)
var (
// global flags
// TODO: add timeout flag
// TODO: add flag to show http request made
rootCmd = &cobra.Command{
Use: "vespa",
Short: "A command-line tool for working with Vespa instances",
}
color aurora.Aurora
)
func configureLogger() {
color = aurora.NewAurora(isatty.IsTerminal(os.Stdout.Fd()))
log.SetFlags(0) // No timestamps
log.SetOutput(colorable.NewColorableStdout())
}
func init() {
configureLogger()
cobra.OnInitialize(readConfig)
}
// Execute executes the root command.
func Execute() error { return rootCmd.Execute() }
|