Skip to content

Instantly share code, notes, and snippets.

@Adron
Created December 5, 2018 00:13
Show Gist options
  • Save Adron/dd26fb08bf602f33a619b1280c290402 to your computer and use it in GitHub Desktop.
Save Adron/dd26fb08bf602f33a619b1280c290402 to your computer and use it in GitHub Desktop.
package cmd
import (
"fmt"
"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 the custom 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.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Twitterers File: %s\n", viper.GetString("file"))
fmt.Printf("Export File: %s\n", viper.GetString("fileExport"))
fmt.Printf("Export Format: %s\n", viper.GetString("fileFormat"))<span data-mce-type="bookmark" id="mce_SELREST_start" data-mce-style="overflow:hidden;line-height:0" style="overflow:hidden;line-height:0;"></span>
},
}
func init() {
rootCmd.AddCommand(configCmd)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment