[asterisk-dev] CLI: list vs show ? (Re: [asterisk-commits] oej:
branch 1.4 r46216 - /branches/1.4/channels/chan_sip.c)
Brian Candler
B.Candler at pobox.com
Thu Oct 26 06:30:32 MST 2006
On Wed, Oct 25, 2006 at 07:36:56PM -0500, Tilghman Lesher wrote:
> > It is _not_ "noun verb", it is "category noun verb". I don't think
> > very many people would want 50+ commands that all start with 'show'
> > and tab completion that crosses all the possible categories.
>
> s/category noun verb/category verb argument/
>
> "sip" is the category, "show" is the verb, "peers" is the argument.
Ah, but it's not any more - it's "sip list peers", or else
"sip show peer <foo>". That's what I find confusing.
A Cisco router deals with it as follows [1]:
show ip route -- show a summary of all routes (1 or 2 lines each)
show ip route x.x.x.x -- show detail about this route (screenful)
show ip bgp neighbors -- summary of all peers
show ip bgp neighbors 1.2.3.4 -- detail about this one peer
Now, I don't see why Asterisk couldn't be the same: e.g.
sip show peer[s] -- summary list
sip show peer[s] <foo> -- detail for one peer
which I would find much more natural.
Otherwise, I don't have any objection to the current arrangement of
<modulename> <command> [<parameters>...]
given that Asterisk is very modular, and administrators are generally aware
of the discrete modules in their system. It's clear that you're sending a
command to the given module. I've also seen other devices which work this
way, e.g. Ericsson routers:
wireless list transports
wireless set transport foobar ssid xyz
wireless set radio radio1 enable
As long as it's consistent, I think it's fine. [2]
You could of course shuffle the command line arguments around, so that
foo flurble bar wibble
sends message "foo bar wibble" to the "flurble" module. This would probably
be OK, as long as modules are reasonably consistent in their naming of
commands. e.g.
sip show peers becomes show sip peers
sip debug debug sip
core debug 4 debug core 4
core verbose 4 becomes verbose core 4
However I don't have a strong desire for this. It might be awkward in some
cases; let's say you add a module "test" which has functions like ping and
traceroute. Then you'd have commands like
ping test 1.2.3.4
traceroute test 5.6.7.8
which I think are less natural than naming the module first, i.e.
test ping 1.2.3.4
test traceroute 5.6.7.8
That's unless modules could register their commands at the top level, in
which case it would just be 'ping 1.2.3.4'; but you lose the clarity over
which module you're sending the command to, and add the risk of namespace
clashes between modules.
Just a few thoughts...
Regards,
Brian.
[1] Here's an example:
router>show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static
route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 128.223.51.1 to network 0.0.0.0
B 217.170.115.0/24 [20/0] via 195.66.232.239, 5d05h
B 216.221.5.0/24 [20/3005] via 208.51.134.254, 1w0d
B 210.51.225.0/24 [20/4294967294] via 144.228.241.81, 17:32:59
B 209.136.89.0/24 [20/0] via 12.0.1.63, 1w4d
B 209.34.243.0/24 [20/0] via 12.0.1.63, 1w2d
B 205.204.1.0/24 [20/0] via 157.130.10.233, 00:00:30
B 204.255.51.0/24 [20/4294967294] via 144.228.241.81, 14:12:55
B 204.238.34.0/24 [20/2593] via 216.140.8.59, 4d02h
B 204.221.17.0/24 [20/0] via 12.0.1.63, 4d02h
B 204.17.221.0/24 [20/0] via 12.0.1.63, 1w4d
203.238.37.0/24 is variably subnetted, 3 subnets, 2 masks
B 203.238.37.0/24 [20/0] via 12.0.1.63, 1w2d
B 203.238.37.96/27 [20/0] via 203.181.248.233, 1w2d
B 203.238.37.128/27 [20/0] via 203.181.248.233, 1w2d
B 203.170.97.0/24 [20/0] via 4.68.1.166, 1w0d
router>show ip route 217.170.115.0
Routing entry for 217.170.115.0/24
Known via "bgp 6447", distance 20, metric 0
Tag 5459, type external
Last update from 195.66.232.239 5d05h ago
Routing Descriptor Blocks:
* 195.66.232.239, from 195.66.232.239, 5d05h ago
Route metric is 0, traffic share count is 1
AS Hops 4
Route tag 5459
router>
[2] Cisco deals with this in two ways depending on the context. In the
configuration language you have <module> <parameters>, e.g.
ip route . . .
router ospf 0
. . .
crypto ipsec . . .
In the command language you usually have <verb> <module> <parameters>, e.g.
show ip route
show crypto ipsec . . .
although I think there are exceptions, e.g.
clock set ...
More information about the asterisk-dev
mailing list