Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "set", Short: "Set new or update the existing command in the current project configuration", Long: `Set new or update the existing command in the current project configuration - command name is a one word: without spaces, dashes and underscores are allowed - command should be double-quoted if it the command contain spaces For example: 1build set test "npm run test" 1build set npm-test "npm run test" 1build set npm_test "npm run test" This will update the current project configuration file.`, Args: cobra.ExactArgs(2), PreRun: func(cmd *cobra.Command, args []string) { _, err := config.LoadOneBuildConfiguration() if err != nil { fmt.Println(err) utils.ExitError() } commandName := args[0] matched, _ := regexp.MatchString(`^[a-zA-Z0-9\-_]+$`, commandName) if !matched { fmt.Println("1build set: '" + commandName + "' is not a valid command name. See '1build set --help'.") utils.ExitError() } }, Run: func(cmd *cobra.Command, args []string) { commandName := args[0] commandValue := args[1] configuration, err := buildAndSetCommand(commandName, commandValue) if err != nil { fmt.Println(err) return } _ = config.WriteConfigFile(configuration) }, }
Cmd cobra command for setting one build configuration command
Functions ¶
func IndexOfCommandIfPresent ¶
func IndexOfCommandIfPresent(configuration config.OneBuildConfiguration, commandName string) int
IndexOfCommandIfPresent returns index in configuration for command if exists
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.