command_dump.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * command_dump.c
  3. */
  4. #include "lub/dump.h"
  5. #include "clish/action.h"
  6. #include "private.h"
  7. /*--------------------------------------------------------- */
  8. void clish_command_dump(const clish_command_t * this)
  9. {
  10. unsigned i;
  11. char *cfg_op;
  12. lub_dump_printf("command(%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("link : %s\n",
  17. this->link ? clish_command__get_name(this->link) : "(null)");
  18. lub_dump_printf("alias : %s\n", this->alias);
  19. lub_dump_printf("alias_view : %s\n",
  20. this->alias_view ? clish_view__get_name(this->alias_view) : "(null)");
  21. clish_action_dump(this->action);
  22. lub_dump_printf("paramc : %d\n", clish_paramv__get_count(this->paramv));
  23. lub_dump_printf("detail : %s\n",
  24. this->detail ? this->detail : "(null)");
  25. switch (this->cfg_op) {
  26. case CLISH_CONFIG_NONE:
  27. cfg_op = "NONE";
  28. break;
  29. case CLISH_CONFIG_SET:
  30. cfg_op = "SET";
  31. break;
  32. case CLISH_CONFIG_UNSET:
  33. cfg_op = "UNSET";
  34. break;
  35. default:
  36. cfg_op = "Unknown";
  37. break;
  38. }
  39. lub_dump_printf("cfg_op : %s\n", cfg_op);
  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_command__get_param(this, i));
  43. }
  44. lub_dump_undent();
  45. }
  46. /*--------------------------------------------------------- */