[asterisk-dev] Standardizing CLI commands across modules

Leif Madsen leif.madsen at asteriskdocs.org
Fri Jul 9 22:41:35 CDT 2010


On 10-07-09 09:57 PM, Paul Belanger wrote:
> All,
>
> Had a discussion with Leif last week about a new type of bug within
> Asterisk; Inconsistent.  A good example is within the CLI. For
> example,  we have '... show settings', '... show status' and '...
> status' CLI commands.  3 different commands to provide the same
> output, default settings for a module. Some examples: 'manager show
> settings', 'core show settings', 'sip show settings' and 'cdr show
> status', 'cel show status', and 'dnsmgr status', 'features show'

Funny enough, the CLI commands should actually be one of the most consistent 
parts of Asterisk (at least as of Asterisk branch 1.6.2 -- if you view it from 
consistency across branches, then I would agree it has been inconsistent -- more 
on that in a moment).

> I'm proposing we agree on a format and convert the remaining modules
> to follow suit. With the creation of cli_alias.conf, the switch  to
> new CLI commands could be handle without creating a 'deprecated'
> message (However that is still to be determined).

Actually there is already a format for this:

<module> <verb> <option>

Tilghman started this work on Asterisk 1.4 (which caused CLI changes from 1.2 -> 
1.4) and then some additional work got done for 1.6.0 (so again, it looked like 
the CLI changed) and then at AstriDevCon 2 years ago, Claude Patry, Michel van 
Baak, and myself decided to spend 3 days going through the Asterisk CLI and 
tried to get the CLI to match the <module> <verb> <options> format as closely as 
possible.

At the same time of doing that, Joshua Colp created the CLI aliases module, and 
we then created templates for those who wanted templates to match other Asterisk 
versions, such as 1.4 (which many people had grown accustomed to, and weren't 
fans of the CLI commands changing on them).

However, it appears you have pointed out a few inconsistencies that we missed 
(how dare you!).

I would agree that anything that is something like:

cdr show status

or

features show

...should probably be updated to be slightly more consistent to match other 
commands. 'cdr show status' might actually be a better name than 'settings' if 
it is really showing a status rather than a list of options and their values 
(like 'sip show settings') but to be consistent perhaps 'cdr show settings' is 
more appropriate.

'features show settings' is probably the right one as well.

> My question is what do people prefer? And do you consider this a
> problem too? Personally, I like 'sip show settings' over 'sip show
> status' or 'sip status'.

Luckily this discussion was already done a long time ago. The set upon format 
for a CLI command is <module> (sip) <verb> (show) <options> (settings).

It seems you've pointed out a few that we missed, so we should probably get 
those updated to be consistent with all the other CLI commands.

We should also make sure anything that we change also gets a [1.6.2] template in 
order to show which commands were changed, and to allow people the time to 
adjust (yay for CLI aliases!)

> The benefit would be more consistent documentation and training for new users.

Agreed.

Leif Madsen.



More information about the asterisk-dev mailing list