1
0

private.h 870 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * ptype.h
  3. */
  4. #include "clish/pargv.h"
  5. #include "lub/argv.h"
  6. #include <sys/types.h>
  7. #include <regex.h>
  8. typedef struct clish_ptype_integer_s clish_ptype_integer_t;
  9. struct clish_ptype_integer_s {
  10. int min;
  11. int max;
  12. };
  13. typedef struct clish_ptype_select_s clish_ptype_select_t;
  14. struct clish_ptype_select_s {
  15. lub_argv_t *items;
  16. };
  17. typedef struct clish_ptype_regex_s clish_ptype_regex_t;
  18. struct clish_ptype_regex_s {
  19. bool_t is_compiled;
  20. regex_t re;
  21. };
  22. struct clish_ptype_s {
  23. char *name;
  24. char *text;
  25. char *pattern;
  26. char *range;
  27. char *completion; // Default completion for PARAMs of this PTYPE
  28. clish_ptype_method_e method;
  29. clish_ptype_preprocess_e preprocess;
  30. unsigned int last_name; /* Index used for auto-completion */
  31. union {
  32. clish_ptype_regex_t regex;
  33. clish_ptype_integer_t integer;
  34. clish_ptype_select_t select;
  35. } u;
  36. clish_action_t *action;
  37. };