From 4cf00a89810cd529cceb5920a28dfa0198c57b6c Mon Sep 17 00:00:00 2001 From: John Southworth Date: Thu, 31 Mar 2011 14:11:47 -0500 Subject: Clean up 'show interfaces' a bit. 1. Don't show sit0 and gre0 interfaces These confuse users that don't know why they are there. 2. Reformat the output so that IPv6 addresses no longer cause formatting problems --- scripts/vyatta-show-interfaces.pl | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl index 6daa2a4..f278ddd 100755 --- a/scripts/vyatta-show-interfaces.pl +++ b/scripts/vyatta-show-interfaces.pl @@ -236,19 +236,24 @@ sub run_show_intf { sub run_show_intf_brief { my @intfs = @_; - my $format = "%-12s %-18s %-11s %-6s %-29s\n"; - printf($format, "Interface","IP Address","State","Link","Description"); + my $format = "%-10s %-11s %-6s %-48s\n"; + my $format2 = "%-1s %-40s\n"; + printf($format, "Interface","State","Link","Description"); + printf($format, "---------","-----","----","-----------"); foreach my $intf (@intfs) { - my @ip_addr = get_ipaddr($intf); - my ($state, $link) = get_state_link($intf); - my $description = get_intf_description($intf); - if (scalar(@ip_addr) == 0) { - printf($format, $intf, "-", $state, $link, $description); - } else { - foreach my $ip (@ip_addr) { - printf($format, $intf, $ip, $state, $link, $description); - } - } + next if ($intf =~ /gre0/); + next if ($intf =~ /sit0/); + my @ip_addr = get_ipaddr($intf); + my ($state, $link) = get_state_link($intf); + my $description = get_intf_description($intf); + if (scalar(@ip_addr) == 0) { + printf($format, $intf, $state, $link, $description); + } else { + printf($format, $intf, $state, $link, $description); + foreach my $ip (@ip_addr) { + printf($format2,'', "$ip"); + } + } } } -- cgit v1.2.3