mirror of
https://gitlab.com/psuapp/psu.git
synced 2024-08-30 18:12:34 +00:00
Format code
This commit is contained in:
parent
d770da7414
commit
a22aaa20f5
@ -12,8 +12,8 @@ import (
|
|||||||
|
|
||||||
// configCmd represents the config command
|
// configCmd represents the config command
|
||||||
var configCmd = &cobra.Command{
|
var configCmd = &cobra.Command{
|
||||||
Use: "config KEY [VALUE]",
|
Use: "config KEY [VALUE]",
|
||||||
Short: "Get and set configuration options",
|
Short: "Get and set configuration options",
|
||||||
Example: "psu config user admin",
|
Example: "psu config user admin",
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
@ -46,7 +46,7 @@ func init() {
|
|||||||
rootCmd.AddCommand(configCmd)
|
rootCmd.AddCommand(configCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func loadCofig () (*viper.Viper, error) {
|
func loadCofig() (*viper.Viper, error) {
|
||||||
// Set config file name
|
// Set config file name
|
||||||
var configFile string
|
var configFile string
|
||||||
if viper.ConfigFileUsed() != "" {
|
if viper.ConfigFileUsed() != "" {
|
||||||
@ -74,7 +74,7 @@ func loadCofig () (*viper.Viper, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getConfig(key string) (interface{}, error) {
|
func getConfig(key string) (interface{}, error) {
|
||||||
newViper, configLoadingErr := loadCofig ()
|
newViper, configLoadingErr := loadCofig()
|
||||||
if configLoadingErr != nil {
|
if configLoadingErr != nil {
|
||||||
return nil, configLoadingErr
|
return nil, configLoadingErr
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ func getConfig(key string) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setConfig(key string, value string) error {
|
func setConfig(key string, value string) error {
|
||||||
newViper, configLoadingErr := loadCofig ()
|
newViper, configLoadingErr := loadCofig()
|
||||||
if configLoadingErr != nil {
|
if configLoadingErr != nil {
|
||||||
return configLoadingErr
|
return configLoadingErr
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
|
|
||||||
// configListCmd represents the list command
|
// configListCmd represents the list command
|
||||||
var configListCmd = &cobra.Command{
|
var configListCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List configs",
|
Short: "List configs",
|
||||||
Aliases: []string{"ls"},
|
Aliases: []string{"ls"},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
// Get alphabetically ordered list of config keys
|
// Get alphabetically ordered list of config keys
|
||||||
|
@ -16,7 +16,7 @@ var cfgFile string
|
|||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "psu",
|
Use: "psu",
|
||||||
Short: "A CLI client for Portainer",
|
Short: "A CLI client for Portainer",
|
||||||
Version: "is set on common/version.CurrentVersion",
|
Version: "is set on common/version.CurrentVersion",
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute adds all child commands to the root command and sets flags appropriately.
|
// Execute adds all child commands to the root command and sets flags appropriately.
|
||||||
|
Loading…
Reference in New Issue
Block a user