Пример #1
0
func performRmr(args []string) error {
	wasp.SetToken(config.GetAuthToken())
	if len(args) != 1 {
		return errors.New("rmr takes exactly 1 argument")
	}
	path := args[0]
	if path == "" {
		log.Fatal("Whoever you are, you just can't delete the entire DB. Not happening man! I'm sorry.")
	}
	var err error
	if yes || util.AskBool("Do you want to delete everything under "+path+"? [yN]: ") {
		log.Println("Deleting the configuration recursively at " + path)
		_, err = wasp.Delete(path)
	}
	return err
}
Пример #2
0
func performPut(args []string) error {
	wasp.SetToken(config.GetAuthToken())
	if len(args) != 2 && !stdIn {
		return errors.New("put takes exactly 2 arguments")
	}
	path := args[0]
	value := ""
	if stdIn {
		value = util.ReadFullyFromStdin()
	} else {
		value = args[1]
	}

	if !rawData {
		value = util.ToJson(value)
	}
	_, err := wasp.Put(path, value)
	return err
}