1
0

command_dump.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * command_dump.c
  3. */
  4. #include "private.h"
  5. #include "lub/dump.h"
  6. /*--------------------------------------------------------- */
  7. void clish_command_dump(const clish_command_t * this)
  8. {
  9. unsigned i;
  10. char *cfg_op;
  11. lub_dump_printf("command(%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("action : %s\n",
  16. this->action ? this->action : "(null)");
  17. lub_dump_printf("paramc : %d\n", clish_paramv__get_count(this->paramv));
  18. lub_dump_printf("detail : %s\n",
  19. this->detail ? this->detail : "(null)");
  20. lub_dump_printf("builtin : %s\n",
  21. this->builtin ? this->builtin : "(null)");
  22. switch (this->cfg_op) {
  23. case CLISH_CONFIG_NONE:
  24. cfg_op = "NONE";
  25. break;
  26. case CLISH_CONFIG_SET:
  27. cfg_op = "SET";
  28. break;
  29. case CLISH_CONFIG_UNSET:
  30. cfg_op = "UNSET";
  31. break;
  32. default:
  33. cfg_op = "Unknown";
  34. break;
  35. }
  36. lub_dump_printf("cfg_op : %s\n", cfg_op);
  37. /* Get each parameter to dump their details */
  38. for (i = 0; i < clish_paramv__get_count(this->paramv); i++) {
  39. clish_param_dump(clish_command__get_param(this, i));
  40. }
  41. lub_dump_undent();
  42. }
  43. /*--------------------------------------------------------- */