Exemplo n.º 1
0
func TestListKnownActions(t *testing.T) {
	do := definitions.NowDo()
	do.Quiet = true
	tests.IfExit(list.ListActions(do))
	k := strings.Split(do.Result, "\n") // tests output formatting.

	ver.ACTION_DEFINITIONS = append(ver.ACTION_DEFINITIONS, "do_not_use.toml")

	if len(k) != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Did not find correct number of action definitions files, Expected %v, found %v.\n", len(ver.ACTION_DEFINITIONS), len(k)))
	}

	actDefs := make(map[string]bool)

	for _, act := range ver.ACTION_DEFINITIONS {
		actDef := strings.Split(act, ".")
		actDefs[actDef[0]] = true
	}

	i := 0
	for _, actFile := range k {
		if actDefs[actFile] == true {
			i++
		}
	}

	if i != len(ver.ACTION_DEFINITIONS) {
		tests.IfExit(fmt.Errorf("Could not find all the expected action definition files.\n"))
	}
}
Exemplo n.º 2
0
func ListAllTheThings() {
	//do.All for known/existing/running
	do.All = true

	typs := []string{"chains", "services"}
	for _, typ := range typs {
		if err := list.ListAll(do, typ); err != nil {
			return
		}
	}
	if err := list.ListDatas(do); err != nil {
		return
	}
	if err := list.ListActions(do); err != nil {
		return
	}
}
Exemplo n.º 3
0
func ListActions(cmd *cobra.Command, args []string) {
	// TODO: add scoping for when projects done.
	IfExit(ArgCheck(0, "eq", cmd, args))
	IfExit(list.ListActions(do))
}