config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config provides configuration management commands for Nix Foundry. It implements Cobra commands for initializing, applying, listing, and showing configuration details. The package supports different configuration types (user, team, project) and handles inheritance between configurations.

Package config provides configuration management commands for Nix Foundry.

Package config provides configuration management commands for Nix Foundry. It implements Cobra commands for managing configuration files, including initialization, modification, and cleanup of configuration settings across different scopes (user, team, project).

Index

Constants

This section is empty.

Variables

View Source
var ApplyCmd = &cobra.Command{
	Use:   "apply",
	Short: "Apply the current configuration",
	Long: `Apply the current configuration.
This command will load and apply the active configuration, including any inherited configurations.`,
	RunE: runApply,
}

ApplyCmd represents the apply command for executing the current configuration. It loads the active configuration (including any inherited configurations) and applies all settings, including shell configuration, package installation, and script execution.

View Source
var InitCmd = &cobra.Command{
	Use:   "init",
	Short: "Initialize a new configuration",
	Long: `Initialize a new configuration.
This command will create a new configuration file of the specified type.`,
	RunE: func(cmd *cobra.Command, args []string) error {
		configSvc := config.GetConfigService()

		if configType == "user" {
			if err := configSvc.InitConfig(); err != nil {
				return fmt.Errorf("failed to initialize user config: %w", err)
			}
			fmt.Println("✨ User configuration initialized successfully!")
			return nil
		}

		if configName == "" {
			return fmt.Errorf("name is required for %s configs", configType)
		}

		if err := configSvc.InitConfigWithType(schema.ConfigType(configType), configName); err != nil {
			return fmt.Errorf("failed to initialize %s config: %w", configType, err)
		}

		caser := cases.Title(language.English)
		fmt.Printf("✨ %s configuration '%s' initialized successfully!\n",
			caser.String(string(configType)), configName)
		return nil
	},
}

InitCmd represents the init command for creating new configurations. It supports creating different types of configurations: - User configuration: Personal settings and preferences - Team configuration: Shared settings for a team - Project configuration: Project-specific requirements Each type has different requirements and inheritance capabilities.

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List available configurations",
	Long: `List available configurations.
This command will show all available configurations of each type.`,
	RunE: runList,
}

ListCmd represents the list command for displaying available configurations. It shows all configurations across different types (user, team, project), including their inheritance relationships and basic metadata.

View Source
var SetCmd = set.Cmd

SetCmd represents the set command

View Source
var ShowCmd = &cobra.Command{
	Use:   "show [name]",
	Short: "Show configuration details",
	Long: `Show configuration details.
This command will display the full details of a configuration.
If no name is provided, it will show the active configuration.`,
	RunE: runShow,
}

ShowCmd represents the show command for displaying detailed configuration information. It can show either the active configuration or a specific configuration by name and type. The output includes all configuration details including metadata, settings, packages, and scripts.

Functions

func NewScriptCmd

func NewScriptCmd() *cobra.Command

NewScriptCmd creates a new script command.

func NewUninstallCmd

func NewUninstallCmd() *cobra.Command

NewUninstallCmd creates a new uninstall command for removing Nix Foundry configuration. It returns a Cobra command that when executed will remove all configuration files and directories associated with Nix Foundry, effectively resetting the configuration state of the system.

Types

This section is empty.

Directories

Path Synopsis
Package set provides commands for setting various configuration options in Nix Foundry.
Package set provides commands for setting various configuration options in Nix Foundry.

Jump to

Keyboard shortcuts

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