1
0

param_dump.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifdef DEBUG
  2. /*
  3. * param_dump.c
  4. */
  5. #include "private.h"
  6. #include "lub/dump.h"
  7. /*--------------------------------------------------------- */
  8. void clish_param_dump(const clish_param_t * this)
  9. {
  10. unsigned i;
  11. char *mode;
  12. lub_dump_printf("param(%p)\n", this);
  13. lub_dump_indent();
  14. lub_dump_printf("name : %s\n", this->name);
  15. lub_dump_printf("text : %s\n", this->text);
  16. lub_dump_printf("value : %s\n", this->value);
  17. lub_dump_printf("ptype : %s\n", clish_ptype__get_name(this->ptype));
  18. lub_dump_printf("default : %s\n",
  19. this->defval ? this->defval : "(null)");
  20. switch (this->mode) {
  21. case CLISH_PARAM_COMMON:
  22. mode = "COMMON";
  23. break;
  24. case CLISH_PARAM_SWITCH:
  25. mode = "SWITCH";
  26. break;
  27. case CLISH_PARAM_SUBCOMMAND:
  28. mode = "SUBCOMMAND";
  29. break;
  30. default:
  31. mode = "Unknown";
  32. break;
  33. }
  34. lub_dump_printf("mode : %s\n", mode);
  35. lub_dump_printf("paramc : %d\n", clish_paramv__get_count(this->paramv));
  36. lub_dump_printf("optional : %s\n",
  37. this->optional ? "true" : "false");
  38. lub_dump_printf("hidden : %s\n",
  39. this->hidden ? "true" : "false");
  40. lub_dump_printf("test : %s\n", this->test);
  41. lub_dump_printf("completion : %s\n", this->completion);
  42. /* Get each parameter to dump their details */
  43. for (i = 0; i < clish_paramv__get_count(this->paramv); i++) {
  44. clish_param_dump(clish_param__get_param(this, i));
  45. }
  46. lub_dump_undent();
  47. }
  48. /*--------------------------------------------------------- */
  49. #endif /* DEBUG */