1
0

command.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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/pargv.h"
  10. #include "clish/view.h"
  11. #include "clish/param.h"
  12. #include "clish/private.h"
  13. typedef enum {
  14. CLISH_CONFIG_NONE,
  15. CLISH_CONFIG_SET,
  16. CLISH_CONFIG_UNSET,
  17. CLISH_CONFIG_DUMP
  18. } clish_config_operation_t;
  19. /*=====================================
  20. * COMMAND INTERFACE
  21. *===================================== */
  22. /*-----------------
  23. * meta functions
  24. *----------------- */
  25. clish_command_t *clish_command_new(const char *name, const char *help);
  26. clish_command_t *clish_command_new_link(const char *name,
  27. const char *help, const clish_command_t * ref);
  28. clish_command_t * clish_command_alias_to_link(clish_command_t * instance);
  29. int clish_command_bt_compare(const void *clientnode, const void *clientkey);
  30. void clish_command_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
  31. size_t clish_command_bt_offset(void);
  32. clish_command_t *clish_command_choose_longest(clish_command_t * cmd1,
  33. clish_command_t * cmd2);
  34. int
  35. clish_command_diff(const clish_command_t * cmd1, const clish_command_t * cmd2);
  36. /*-----------------
  37. * methods
  38. *----------------- */
  39. void clish_command_delete(clish_command_t * instance);
  40. void
  41. clish_command_insert_param(clish_command_t * instance, clish_param_t * param);
  42. int clish_command_help(const clish_command_t * instance, help_argv_t *help,
  43. const char *viewid, const char *line);
  44. void clish_command_dump(const clish_command_t * instance);
  45. /*-----------------
  46. * attributes
  47. *----------------- */
  48. const char *clish_command__get_name(const clish_command_t * instance);
  49. const char *clish_command__get_suffix(const clish_command_t * instance);
  50. const char *clish_command__get_text(const clish_command_t * instance);
  51. const char *clish_command__get_detail(const clish_command_t * instance);
  52. const char *clish_command__get_builtin(const clish_command_t * instance);
  53. const char *clish_command__get_escape_chars(const clish_command_t * instance);
  54. const clish_param_t *clish_command__get_args(const clish_command_t * instance);
  55. char *clish_command__get_action(const clish_command_t * instance,
  56. const char *viewid, clish_pargv_t * pargv);
  57. clish_view_t *clish_command__get_view(const clish_command_t * instance);
  58. char *clish_command__get_viewid(const clish_command_t * instance,
  59. const char *viewid, clish_pargv_t * pargv);
  60. const unsigned clish_command__get_param_count(const clish_command_t * instance);
  61. const clish_param_t *clish_command__get_param(const clish_command_t * instance,
  62. unsigned index);
  63. clish_paramv_t *clish_command__get_paramv(const clish_command_t * instance);
  64. void clish_command__set_action(clish_command_t * instance, const char *action);
  65. void
  66. clish_command__set_builtin(clish_command_t * instance, const char *builtin);
  67. void
  68. clish_command__set_escape_chars(clish_command_t * instance,
  69. const char *escape_chars);
  70. void clish_command__set_args(clish_command_t * instance, clish_param_t * args);
  71. void clish_command__set_detail(clish_command_t * instance, const char *detail);
  72. void clish_command__set_view(clish_command_t * instance, clish_view_t * view);
  73. void clish_command__force_view(clish_command_t * instance, clish_view_t * view);
  74. void clish_command__set_viewid(clish_command_t * instance, const char *viewid);
  75. void clish_command__force_viewid(clish_command_t * instance, const char *viewid);
  76. void clish_command__set_pview(clish_command_t * instance, clish_view_t * view);
  77. clish_view_t *clish_command__get_pview(const clish_command_t * instance);
  78. unsigned clish_command__get_depth(const clish_command_t * instance);
  79. void
  80. clish_command__set_cfg_op(clish_command_t * instance,
  81. clish_config_operation_t operation);
  82. clish_config_operation_t
  83. clish_command__get_cfg_op(const clish_command_t * instance);
  84. void clish_command__set_priority(clish_command_t * instance, unsigned short priority);
  85. unsigned short clish_command__get_priority(const clish_command_t * instance);
  86. void
  87. clish_command__set_pattern(clish_command_t * instance, const char *pattern);
  88. char *clish_command__get_pattern(const clish_command_t * instance,
  89. const char * viewid, clish_pargv_t * pargv);
  90. void clish_command__set_file(clish_command_t * instance, const char *file);
  91. char *clish_command__get_file(const clish_command_t * instance,
  92. const char * viewid, clish_pargv_t * pargv);
  93. void clish_command__set_splitter(clish_command_t * instance, bool_t splitter);
  94. bool_t clish_command__get_splitter(const clish_command_t * instance);
  95. const char * clish_command__is_seq(const clish_command_t * instance);
  96. void clish_command__set_seq(clish_command_t * instance, const char * seq_num);
  97. unsigned short clish_command__get_seq(const clish_command_t * instance,
  98. const char *viewid, clish_pargv_t * pargv);
  99. clish_view_restore_t clish_command__get_restore(const clish_command_t * instance);
  100. bool_t clish_command__get_unique(const clish_command_t * instance);
  101. void clish_command__set_unique(clish_command_t * instance, bool_t unique);
  102. const clish_command_t * clish_command__get_orig(const clish_command_t * instance);
  103. const clish_command_t * clish_command__get_cmd(const clish_command_t * instance);
  104. void clish_command__set_cfg_depth(clish_command_t * instance, const char * cfg_depth);
  105. unsigned clish_command__get_cfg_depth(const clish_command_t * instance,
  106. const char *viewid, clish_pargv_t * pargv);
  107. bool_t clish_command__get_lock(const clish_command_t * instance);
  108. void clish_command__set_lock(clish_command_t * instance, bool_t lock);
  109. const char * clish_command__get_shebang(const clish_command_t * instance);
  110. void clish_command__set_shebang(clish_command_t * instance, const char * shebang);
  111. void clish_command__set_alias(clish_command_t * instance, const char * alias);
  112. const char * clish_command__get_alias(const clish_command_t * instance);
  113. void clish_command__set_alias_view(clish_command_t * instance,
  114. clish_view_t * alias_view);
  115. clish_view_t * clish_command__get_alias_view(const clish_command_t * instance);
  116. void clish_command__set_dynamic(clish_command_t * instance, bool_t dynamic);
  117. bool_t clish_command__get_dynamic(const clish_command_t * instance);
  118. bool_t clish_command__get_interrupt(const clish_command_t * instance);
  119. void clish_command__set_interrupt(clish_command_t * instance, bool_t interrupt);
  120. #endif /* _clish_command_h */