.eval_free = ec_node_cmd_eval_free,
};
-static int ec_node_cmd_parse(const struct ec_node *gen_node,
- struct ec_parsed *state,
- const struct ec_strvec *strvec)
+static int
+ec_node_cmd_parse(const struct ec_node *gen_node, struct ec_parsed *state,
+ const struct ec_strvec *strvec)
{
struct ec_node_cmd *node = (struct ec_node_cmd *)gen_node;
return ec_node_parse_child(node->cmd, state, strvec);
}
-static struct ec_completed *ec_node_cmd_complete(const struct ec_node *gen_node,
- struct ec_parsed *state,
- const struct ec_strvec *strvec)
+static int
+ec_node_cmd_complete(const struct ec_node *gen_node,
+ struct ec_completed *completed,
+ struct ec_parsed *parsed,
+ const struct ec_strvec *strvec)
{
struct ec_node_cmd *node = (struct ec_node_cmd *)gen_node;
- return ec_node_complete_child(node->cmd, state, strvec);
+ return ec_node_complete_child(node->cmd, completed, parsed, strvec);
}
static void ec_node_cmd_free_priv(struct ec_node *gen_node)
ret |= EC_TEST_CHECK_PARSE(node, -1, "foo");
ec_node_free(node);
- node = EC_NODE_CMD(NULL, "good morning bob|bobby|michael [count]",
+ node = EC_NODE_CMD(NULL, "good morning [count] bob|bobby|michael",
ec_node_int("count", 0, 10, 10));
if (node == NULL) {
ec_log(EC_LOG_ERR, "cannot create node\n");
return -1;
}
- ret |= EC_TEST_CHECK_PARSE(node, 4, "good", "morning", "bob", "1");
- ec_node_free(node);
+ ret |= EC_TEST_CHECK_PARSE(node, 4, "good", "morning", "1", "bob");
+
+ ret |= EC_TEST_CHECK_COMPLETE(node,
+ "", EC_NODE_ENDLIST,
+ "good", EC_NODE_ENDLIST,
+ "good");
+ ret |= EC_TEST_CHECK_COMPLETE(node,
+ "g", EC_NODE_ENDLIST,
+ "ood", EC_NODE_ENDLIST,
+ "ood");
+ ret |= EC_TEST_CHECK_COMPLETE(node,
+ "good", "morning", "", EC_NODE_ENDLIST,
+ "bob", "bobby", "michael", EC_NODE_ENDLIST,
+ "");
- // XXX completion
+ ec_node_free(node);
return ret;
}