Tips and tricks with EVA CLI

Primary EVA CLI tools are eva (./bin/eva) and eva-shell (./bin/eva -I or ./bin/eva-shell). Actually it’s a same program, which automatically starts itself in interactive mode (-I) when called as eva-shell and without any argument.

Interactive mode

If command “uc”, “lm” or “sfa” is called without arguments, EVA shell will launch corresponding controller sub-shell, which’s equal to calling uc-cmd, lm-cmd and sfa-cmd directly.

You can execute a pack of several commands at once, separating them with “;” symbol, just like in a system shell:

state -p sensor ; state -p unit

The next very useful trick is command repeating. In real life, there’s a lot of examples, when you mount / setup some equipment and need to check its state every second to get the moment it start working correctly. To repeat the command
in EVA shell , symbol “|” (pipe) is used

  • command |X – execute command every X seconds, e.g.: test |1
  • to execute command more frequently than once per second, specify a float number, first zero can be suppressed, e.g.: test |.1 will execute command “test” every 100 milliseconds.
  • if “c” symbol is added before interval, EVA shell will clear screen before every iteration, plus display command information in a header, e.g.: test |c1
  • and of course, several commands can be executed at once and then repeated: just type a commands, split them with ; and place |X at the end:
state -p sensor -g env ; state -p unit |c1

Command mode and auto-completion

EVA CLI has auto-completion in both interactive mode and system shell. While in interactive mode auto-completion is handled by popular completion library argcomplete, in system shell we’ve decided to avoid it: when using argcomplete, system shell should execute Python interpreter to get every next result, which’s very slow.

Instead all EVA CLI tools have pre-generated completion scripts for bash, which can be found in ./etc/bash_completion.d folder. Copy its contents to system /etc/bash_completion.d/, reload bash and that’s it!