This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

cli

Hi,

I am using cli and made my own command like bellow, as you see i have a command with 3 sub commands. But i think my idea is primitive because if i have 1000 sub command so i have to write many functions!!!!

Another problem of using this method is that in putty first i have to write N1 as a sub command and in the next line SEND as a command and then i can see my results. For example :

uart_cli:~$   Do A

uart_cli:~$   DO

But i want  to type like  "SEND N1'' which is contain command and sub command and then get my results. Kindly let me how to do that and let me know if it is possible, how many sub command i can type with that? is there any limitation? For example can i have something like bellow?

uart_cli:~$  DO A L g H Z K

which A, L,H,Z,K are sub commands of DO.

//sub commands
static void cmd_DO_A(nrf_cli_t const * p_cli, size_t argc, char **argv)
      { 
           A = 1;    
      }

static void cmd_DO_B(nrf_cli_t const * p_cli, size_t argc, char **argv)
      { 
          A = 2;
      }

static void cmd_DO_C(nrf_cli_t const * p_cli, size_t argc, char **argv)
      { 
            A = 3;
      }
// Command
static void cmd_DO(nrf_cli_t const * p_cli, size_t argc, char **argv)
{ 
      ASSERT(p_cli);
      //
      //
      //
      //

      switch(A)
      {
        case 1:
                
                break;
         case 2:
             
                break;
         case 3:
                
                break;

Related