configure

package
v0.0.0-...-e7103ae Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigureCmd = &cobra.Command{
	Use:   "configure",
	Short: "Configure settings",
	Long:  `Configure settings of the CLI, like output schema, theme and more`,

	RunE: func(cmd *cobra.Command, args []string) error {
		var items []list.Item

		itemKeys, err := config.GetConfiguredItems()
		if err != nil {
			return err
		}

		sort.Strings(itemKeys)

		for _, k := range itemKeys {
			items = append(items, list.Item(k))
		}

		updateFunc := func(m list.ListModel, keypress string) (tea.Model, tea.Cmd) {
			switch keypress {
			case "q", "ctrl+c":
				m.Quitting = true
				return m, tea.Quit

			case "enter":
				i, ok := m.List.SelectedItem().(list.Item)
				if ok {
					m.Choice = string(i)
					switch m.Choice {
					case "spinner":
						spinner.Configure()
					default:
						configureOption(m.Choice)
					}
				}
				return m, tea.Quit
			}
			return m, nil
		}

		list.DrawList(items, updateFunc)

		return nil
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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