1
0

param_dump.c 1.3 KB

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