You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Michał Narajowski <mi...@codecoup.pl> on 2017/03/07 13:26:51 UTC

[RFC] Shell improvements

Hi,

for the last few weeks, I've been working on improving the shell
functionality.
I prepared a separate app so that it's easy to work on it separately and
play
around with it.

Here are some features of the new shell:

1. First of all, the new shell improves the concept of modules. Modules
group
commands under a namespace. So like in bletiny there is a module named 'b'
and contains commands like 'adv', 'conn', 'term', etc. The module name is
so
short because you have to type it before every command: 'b adv ...'.

With the new shell, you can select a module to be the default module and
just type in
the command names from this module. To select a module type: 'select
[module]'.
To go back to the main shell type 'select'. When you select a new default
module,
the prompt changes:

Default:
'shell> '
selected:
'os> '

The newshell app has two example modules: 'os' and 'prompt'. 'os' contains
system commands from the old shell. 'prompt' contains 'ticks' command.
It can toggle a dynamic shell. A dynamic shell could be used in Bluetooth
app
to display name or address of a connected device.

2. Next major improvement is tab completion. You can complete modules,
commands, and params. When there is more than one option with a specific
prefix
they are printed to the console followed by the current line so
that you can continue to type the name.

```
help
tasks
mpool
date
shell> os <tab>
```

3. Improved help messages
Each command can have additional information associated with it. There is
a summary string, which provides a brief description of the command. It is
displayed
when listing all possible commands in a specific context. Usage string
usually
contains more info and is displayed when the user invokes help command or
when
the user mistyped some parameter for this command. Moreover, a list
of parameters can be passed with the command for tab completion of
parameters
and displaying short descriptions of params.

The help api is designed, so the app can easily compile out the additional
help info to save flash.

4. I separated UART from the shell and added RTT as an optional backend.
RTT is a very high-speed memory-mapped I/O. More info here:

https://www.segger.com/jlink-rtt.html

So now shell can be used with either RTT or UART. It frees up UART so it
can be used for some other purposes while still having shell functionality.

Comments are welcome.
Link to the PR: https://github.com/apache/incubator-mynewt-core/pull/197

Best regards,
Michał