Dev a few more operations
* Archive * Config * Pull out filter generation (from list) for reuse
This commit is contained in:
@@ -6,21 +6,17 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sort"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
// configCmd represents the config command
|
||||
var configCmd = &cobra.Command{
|
||||
Use: "config",
|
||||
Short: "A brief description of your command",
|
||||
Long: `A longer description that spans multiple lines and likely contains examples
|
||||
and usage of using your command. For example:
|
||||
|
||||
Cobra is a CLI library for Go that empowers applications.
|
||||
This application is a tool to generate the needed files
|
||||
to quickly create a Cobra application.`,
|
||||
RunE: opConfig,
|
||||
Short: "Print all configuration values",
|
||||
RunE: opConfig,
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -28,6 +24,14 @@ func init() {
|
||||
}
|
||||
|
||||
func opConfig(cmd *cobra.Command, args []string) error {
|
||||
fmt.Println("config called")
|
||||
var settings []string
|
||||
for k, v := range viper.AllSettings() {
|
||||
settings = append(settings, fmt.Sprintf("%s: %s", k, v))
|
||||
}
|
||||
sort.Strings(settings)
|
||||
fmt.Println("Configuration File:", viper.ConfigFileUsed())
|
||||
for _, v := range settings {
|
||||
fmt.Println(v)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user