command.h 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * command.h
  3. */
  4. #ifndef _clish_command_h
  5. #define _clish_command_h
  6. typedef struct clish_command_s clish_command_t;
  7. #include "lub/bintree.h"
  8. #include "lub/argv.h"
  9. #include "clish/types.h"
  10. #include "clish/pargv.h"
  11. #include "clish/view.h"
  12. #include "clish/param.h"
  13. #include "clish/action.h"
  14. #include "clish/config.h"
  15. /*=====================================
  16. * COMMAND INTERFACE
  17. *===================================== */
  18. /*-----------------
  19. * meta functions
  20. *----------------- */
  21. clish_command_t *clish_command_new(const char *name, const char *help);
  22. clish_command_t *clish_command_new_link(const char *name,
  23. const char *help, const clish_command_t * ref);
  24. clish_command_t * clish_command_alias_to_link(clish_command_t * instance);
  25. int clish_command_bt_compare(const void *clientnode, const void *clientkey);
  26. void clish_command_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  27. size_t clish_command_bt_offset(void);
  28. clish_command_t *clish_command_choose_longest(clish_command_t * cmd1,
  29. clish_command_t * cmd2);
  30. int
  31. clish_command_diff(const clish_command_t * cmd1, const clish_command_t * cmd2);
  32. /*-----------------
  33. * methods
  34. *----------------- */
  35. void clish_command_delete(clish_command_t *instance);
  36. void clish_command_insert_param(clish_command_t *instance,
  37. clish_param_t *param);
  38. int clish_command_help(const clish_command_t *instance);
  39. void clish_command_dump(const clish_command_t *instance);
  40. /*-----------------
  41. * attributes
  42. *----------------- */
  43. const char *clish_command__get_name(const clish_command_t * instance);
  44. const char *clish_command__get_suffix(const clish_command_t * instance);
  45. const char *clish_command__get_text(const clish_command_t * instance);
  46. const char *clish_command__get_detail(const clish_command_t * instance);
  47. const char *clish_command__get_escape_chars(const clish_command_t * instance);
  48. const char *clish_command__get_regex_chars(const clish_command_t * instance);
  49. const clish_param_t *clish_command__get_args(const clish_command_t * instance);
  50. clish_action_t *clish_command__get_action(const clish_command_t *instance);
  51. const char *clish_command__get_view(const clish_command_t *instance);
  52. char *clish_command__get_viewid(const clish_command_t *instance);
  53. unsigned int clish_command__get_param_count(const clish_command_t * instance);
  54. const clish_param_t *clish_command__get_param(const clish_command_t * instance,
  55. unsigned index);
  56. clish_paramv_t *clish_command__get_paramv(const clish_command_t * instance);
  57. void clish_command__set_escape_chars(clish_command_t * instance,
  58. const char *escape_chars);
  59. void clish_command__set_regex_chars(clish_command_t * instance,
  60. const char *escape_chars);
  61. void clish_command__set_args(clish_command_t * instance, clish_param_t * args);
  62. void clish_command__set_detail(clish_command_t * instance, const char *detail);
  63. void clish_command__set_view(clish_command_t *instance, const char *view);
  64. void clish_command__force_view(clish_command_t *instance, const char *view);
  65. void clish_command__set_viewid(clish_command_t * instance, const char *viewid);
  66. void clish_command__force_viewid(clish_command_t * instance, const char *viewid);
  67. void clish_command__set_pview(clish_command_t * instance, clish_view_t * view);
  68. clish_view_t *clish_command__get_pview(const clish_command_t * instance);
  69. int clish_command__get_depth(const clish_command_t * instance);
  70. clish_config_t *clish_command__get_config(const clish_command_t *instance);
  71. clish_view_restore_t clish_command__get_restore(const clish_command_t * instance);
  72. const clish_command_t * clish_command__get_orig(const clish_command_t * instance);
  73. const clish_command_t * clish_command__get_cmd(const clish_command_t * instance);
  74. bool_t clish_command__get_lock(const clish_command_t * instance);
  75. void clish_command__set_lock(clish_command_t * instance, bool_t lock);
  76. void clish_command__set_alias(clish_command_t * instance, const char * alias);
  77. const char * clish_command__get_alias(const clish_command_t * instance);
  78. void clish_command__set_alias_view(clish_command_t * instance,
  79. clish_view_t * alias_view);
  80. clish_view_t * clish_command__get_alias_view(const clish_command_t * instance);
  81. void clish_command__set_dynamic(clish_command_t * instance, bool_t dynamic);
  82. bool_t clish_command__get_dynamic(const clish_command_t * instance);
  83. bool_t clish_command__get_interrupt(const clish_command_t * instance);
  84. void clish_command__set_interrupt(clish_command_t * instance, bool_t interrupt);
  85. #endif /* _clish_command_h */