summaryrefslogtreecommitdiff
path: root/scripts/VyattaConfigOutput.pm
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-11-02 17:01:43 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-11-02 17:01:43 -0700
commit902f98e233479bb9e8fffa9d158d14739714d48a (patch)
treed5684cf1dc78d05218b1c8e2a5f522919b9bf2a1 /scripts/VyattaConfigOutput.pm
parent0d97c5e0f56a22577abb0a38fec10a06e9b618e8 (diff)
downloadvyatta-cfg-902f98e233479bb9e8fffa9d158d14739714d48a.tar.gz
vyatta-cfg-902f98e233479bb9e8fffa9d158d14739714d48a.zip
* config-mode "show" command now hides default values.
* add "show -all" command to display all values. * "save" command saves all values.
Diffstat (limited to 'scripts/VyattaConfigOutput.pm')
-rwxr-xr-xscripts/VyattaConfigOutput.pm18
1 files changed, 15 insertions, 3 deletions
diff --git a/scripts/VyattaConfigOutput.pm b/scripts/VyattaConfigOutput.pm
index 874ed55..f16007d 100755
--- a/scripts/VyattaConfigOutput.pm
+++ b/scripts/VyattaConfigOutput.pm
@@ -13,6 +13,14 @@ use strict;
use lib '/opt/vyatta/share/perl5/';
use VyattaConfig;
+# whether to show default values
+my $show_all = 0;
+sub set_show_all {
+ if (shift) {
+ $show_all = 1;
+ }
+}
+
my $config = undef;
# $0: array ref for path
@@ -25,7 +33,7 @@ sub displayValues {
my $prefix = $_[1];
my $name = $_[2];
my $simple_show = $_[3];
- my ($is_multi, $is_text) = $config->parseTmpl(\@cur_path);
+ my ($is_multi, $is_text, $default) = $config->parseTmpl(\@cur_path);
$config->setLevel(join ' ', @cur_path);
if ($is_multi) {
my @ovals = $config->returnOrigValues('');
@@ -74,7 +82,9 @@ sub displayValues {
}
}
if (defined($simple_show)) {
- print "$prefix$name: $oval\n";
+ if (!defined($default) || $default ne $oval || $show_all) {
+ print "$prefix$name: $oval\n";
+ }
return;
}
my $value = $nval;
@@ -90,7 +100,9 @@ sub displayValues {
$diff = '>';
}
}
- print "$diff$prefix$name: $value\n";
+ if (!defined($default) || $default ne $value || $show_all) {
+ print "$diff$prefix$name: $value\n";
+ }
}
}