Example #1
0
// Gets the nouns from the options document.
// If the opt doc is empty, it returns a default nouns configoration.
func GetNouns(odoc iface.NestedData) map[string]interface{} {
	opt_def := map[string]interface{}{
		"composedOf": []interface{}{
			"jsonedit",
		},
	}
	term_def := map[string]interface{}{
		"composedOf": []interface{}{
			"terminal",
		},
		"verbs": map[string]interface{}{
			"Execute": map[string]interface{}{
				"input": map[string]interface{}{
					"script": 1,
				},
			},
		},
	}
	nouns, ok := odoc.GetM("nouns")
	if !ok {
		nouns = map[string]interface{}{
			"options":  opt_def,
			"terminal": term_def,
		}
	}
	if _, ok := nouns["options"]; !ok {
		nouns["options"] = opt_def
	}
	return nouns
}
Example #2
0
// Gets the nouns from the options document.
// If the opt doc is empty, it returns a default nouns configoration.
func GetNouns(odoc iface.NestedData) map[string]interface{} {
	opt_def := map[string]interface{}{
		"composed_of": []interface{}{"jsonedit"},
	}
	nouns, ok := odoc.GetM("nouns")
	if !ok {
		nouns = map[string]interface{}{
			"options": opt_def,
		}
	}
	if _, ok := nouns["options"]; !ok {
		nouns["options"] = opt_def
	}
	return nouns
}