diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-12 13:49:36 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2015-06-12 13:49:36 +0200 |
commit | 1f53cc0acfc0552172f2b142910f10def4ff0e61 (patch) | |
tree | 9f3433d950297b32f6268b74ded3ce2a5f1f78c1 /src/cli.c | |
parent | 71e8567d8a1b4ec4ce07a4dee990c317ee1681d1 (diff) | |
download | biruda-1f53cc0acfc0552172f2b142910f10def4ff0e61.tar.gz biruda-1f53cc0acfc0552172f2b142910f10def4ff0e61.tar.bz2 |
temporary checkin
Diffstat (limited to 'src/cli.c')
-rw-r--r-- | src/cli.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -27,8 +27,9 @@ typedef enum { COMMAND, // command parsing - START_WORKER, // worker command expecting a worker parameter - STOP_WORKER + START_WORKER, // worker commands expect a worker (and + STOP_WORKER, // optionally an architecture and os parameter) + MESSAGES_WORKER } command_state_t; static char *commands[] = { @@ -100,6 +101,11 @@ static void get_workers( ) free( data ); } +static void print_workers( ) +{ + puts( "available workers..." ); +} + static void completion_func( const char *buf, linenoiseCompletions *lc ) { unsigned int i; @@ -118,6 +124,7 @@ static void completion_func( const char *buf, linenoiseCompletions *lc ) case START_WORKER: case STOP_WORKER: + case MESSAGES_WORKER: get_workers( ); for( int i = 0; i < nof_worker_names; i++ ) { linenoiseAddCompletion( lc, worker_names[i] ); @@ -301,6 +308,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE case START_WORKER: case STOP_WORKER: + case MESSAGES_WORKER: context = "worker"; break; } @@ -320,6 +328,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE case START_WORKER: case STOP_WORKER: + case MESSAGES_WORKER: command_state = COMMAND; continue; } @@ -363,7 +372,7 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE } else if( strncasecmp( line, "stop", 5 ) == 0 ) { command_state = STOP_WORKER; } else if( strncasecmp( line, "messages", 8 ) == 0 ) { - print_messages( ); + command_state = MESSAGES_WORKER; } else if( strncasecmp( line, "autodisp", 8 ) == 0 ) { if( is_interactive ) { autodisp_toggle = !autodisp_toggle; @@ -387,6 +396,11 @@ int start_interactive( bool colors, const char *host, unsigned short port, FILE stop_worker( line ); command_state = COMMAND; break; + + case MESSAGES_WORKER: + print_messages( ); + command_state = COMMAND; + break; } } |