1
0

command_dump.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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("link : %s\n",
  16. this->link ? clish_command__get_name(this->link) : "(null)");
  17. lub_dump_printf("alias : %s\n", this->alias);
  18. lub_dump_printf("alias_view : %s\n",
  19. this->alias_view ? clish_view__get_name(this->alias_view) : "(null)");
  20. lub_dump_printf("action : %s\n",
  21. this->action ? this->action : "(null)");
  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. lub_dump_printf("builtin : %s\n",
  26. this->builtin ? this->builtin : "(null)");
  27. switch (this->cfg_op) {
  28. case CLISH_CONFIG_NONE:
  29. cfg_op = "NONE";
  30. break;
  31. case CLISH_CONFIG_SET:
  32. cfg_op = "SET";
  33. break;
  34. case CLISH_CONFIG_UNSET:
  35. cfg_op = "UNSET";
  36. break;
  37. default:
  38. cfg_op = "Unknown";
  39. break;
  40. }
  41. lub_dump_printf("cfg_op : %s\n", cfg_op);
  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_command__get_param(this, i));
  45. }
  46. lub_dump_undent();
  47. }
  48. /*--------------------------------------------------------- */