diff options
author | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-14 13:47:21 -0700 |
---|---|---|
committer | Michael Larson <slioch@slioch.vyatta.com> | 2010-05-14 13:47:21 -0700 |
commit | d36d0a6ea76d443c5e4072401eaa9dbf563c74bd (patch) | |
tree | 9daed3e19d3d5b8231a9894891ac00d4df9b9c3a /lib/Vyatta/ConfigOutput.pm | |
parent | 91bb77e328c9cad994609aeeccb33971eca1486f (diff) | |
download | vyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.tar.gz vyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.zip |
initial checkin of comment feature for cli.
/* to create a comment */
> comment [PATH-TO-NODE] "my comments"
/* to delete a comment */
> comment [PATH-TO-NODE] ""
Diffstat (limited to 'lib/Vyatta/ConfigOutput.pm')
-rwxr-xr-x | lib/Vyatta/ConfigOutput.pm | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/Vyatta/ConfigOutput.pm b/lib/Vyatta/ConfigOutput.pm index caa9356..99a0da8 100755 --- a/lib/Vyatta/ConfigOutput.pm +++ b/lib/Vyatta/ConfigOutput.pm @@ -82,6 +82,7 @@ sub displayValues { my $HIDE_PASSWORD = '****************'; $config->setLevel(join ' ', @cur_path); + if ($is_multi) { my @ovals = $config->returnOrigValues(''); my @nvals = $config->returnValues(''); @@ -201,6 +202,11 @@ sub displayDeletedOrigChildren { if (!defined $is_tag) { my $path = join(' ',( @cur_path, $child )); + my $comment = $config->returnComment($path); + if (defined $comment) { + print "$prefix /* $comment */\n"; + } + my ($state, $n) = $config->getDeactivated($path); if (defined $state) { $dis = '! '; @@ -211,6 +217,7 @@ sub displayDeletedOrigChildren { } $config->setLevel(join ' ', (@cur_path, $child)); + my @cnames = sort $config->listOrigNodesNoDef(); if ($cnames[0] eq 'node.val') { @@ -227,8 +234,14 @@ sub displayDeletedOrigChildren { next; } - #need separate check here my $path = join(' ',( @cur_path, $child, $cname )); + + my $comment = $config->returnComment($path); + if (defined $comment) { + print "$prefix /* $comment */\n"; + } + + #need separate check here my ($state, $n) = $config->getDeactivated($path); if (defined $state) { $dis = '! '; @@ -288,6 +301,11 @@ sub displayChildren { if (!defined($is_tag)) { my $path = join(' ',( @cur_path, $child )); + my $comment = $config->returnComment($path); + if (defined $comment) { + print "$prefix /* $comment */\n"; + } + my ($state, $n) = $config->getDeactivated($path); if (defined $state) { $dis = '! '; @@ -325,6 +343,11 @@ sub displayChildren { } my $path = join(' ',( @cur_path, $child, $cname )); + my $comment = $config->returnComment($path); + if (defined $comment) { + print "$prefix /* $comment */\n"; + } + my ($state, $n) = $config->getDeactivated($path); if (defined $state) { $dis = '! '; @@ -388,6 +411,7 @@ sub outputNewConfig { $config = new Vyatta::Config; $config->setLevel(join ' ', @_); my %rnodes = $config->listNodeStatus(undef,'true'); + if (scalar(keys %rnodes) > 0) { my @rn = keys %rnodes; |