1
0

param_dump.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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("ptype : %s\n", clish_ptype__get_name(this->ptype));
  16. lub_dump_printf("default: %s\n",
  17. this->defval ? this->defval : "(null)");
  18. switch (this->mode) {
  19. case CLISH_PARAM_COMMON:
  20. mode = "COMMON";
  21. break;
  22. case CLISH_PARAM_SWITCH:
  23. mode = "SWITCH";
  24. break;
  25. case CLISH_PARAM_SUBCOMMAND:
  26. mode = "SUBCOMMAND";
  27. break;
  28. default:
  29. mode = "Unknown";
  30. break;
  31. }
  32. lub_dump_printf("mode : %s\n", mode);
  33. lub_dump_printf("paramc : %d\n", clish_paramv__get_count(this->paramv));
  34. lub_dump_printf("optional : %s\n",
  35. this->optional ? "true" : "false");
  36. /* Get each parameter to dump their details */
  37. for (i = 0; i < clish_paramv__get_count(this->paramv); i++) {
  38. clish_param_dump(clish_param__get_param(this, i));
  39. }
  40. lub_dump_undent();
  41. }
  42. /*--------------------------------------------------------- */