kcommand.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /** @file kcommand.h
  2. *
  3. * @brief Klish scheme's "command" entry
  4. */
  5. #ifndef _klish_kcommand_h
  6. #define _klish_kcommand_h
  7. #include <klish/icommand.h>
  8. #include <klish/kparam.h>
  9. #include <klish/kaction.h>
  10. typedef struct kcommand_s kcommand_t;
  11. C_DECL_BEGIN
  12. kcommand_t *kcommand_new(const char *name);
  13. void kcommand_free(kcommand_t *command);
  14. const char *kcommand_name(const kcommand_t *command);
  15. const char *kcommand_help(const kcommand_t *command);
  16. bool_t kcommand_set_help(kcommand_t *command, const char *help);
  17. bool_t kcommand_add_param(kcommand_t *command, kparam_t *param);
  18. kparam_t *kcommand_find_param(const kcommand_t *command, const char *name);
  19. ssize_t kcommand_params_len(const kcommand_t *command);
  20. bool_t kcommand_add_action(kcommand_t *command, kaction_t *action);
  21. ssize_t kcommand_actions_len(const kcommand_t *command);
  22. bool_t kcommand_parse(kcommand_t *command, const icommand_t *info,
  23. faux_error_t *error);
  24. bool_t kcommand_nested_from_icommand(kcommand_t *kcommand, icommand_t *icommand,
  25. faux_error_t *error);
  26. kcommand_t *kcommand_from_icommand(icommand_t *icommand, faux_error_t *error);
  27. C_DECL_END
  28. #endif // _klish_kcommand_h