config

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "subcommands for webman config",
	Long: `

The "config" subcommand allows you to change your base webman config.
`,
	RunE: func(cmd *cobra.Command, args []string) error {
		cfg, err := config.Load()
		if err != nil {
			return err
		}

		q := &survey.Input{
			Message: "Refresh interval",
			Help:    "How long before webman should refresh a package repository (ex: `6h`)",
			Default: cfg.RefreshInterval.String(),
		}

		if err := survey.AskOne(q, &cfg.RefreshInterval, survey.WithValidator(func(ans interface{}) error {
			_, err := time.ParseDuration(fmt.Sprint(ans))
			return err
		})); err != nil {
			return err
		}

		if err := cfg.Save(); err != nil {
			return err
		}

		color.HiGreen("Config saved")
		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL