config

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RunCmd = &cobra.Command{
	Use:   "config",
	Short: "Viewing and modifying local configurations",
	Run: func(cmd *cobra.Command, args []string) {
		configPath := localConfigFilePath(WorkSpace)
		fmt.Printf("Workspace Config: %s\n\n", configPath)

		raw, err := os.ReadFile(configPath)
		if err != nil {
			fmt.Printf("read config failed: %s\n", err.Error())
			fmt.Println("Generate local configuration with 'nanafs config init'")
			return
		}

		cfg := config.Config{}
		if err := json.Unmarshal(raw, &cfg); err != nil {
			fmt.Printf("load config failed: %s\n", err.Error())
			return
		}

		raw, err = json.MarshalIndent(cfg, "", "    ")
		if err != nil {
			fmt.Printf("marshal config failed: %s\n", err.Error())
			return
		}
		fmt.Println(string(raw))
	},
}
View Source
var WorkSpace string

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