mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-14 07:20:35 -08:00
Add facility to display all options
Copied from Perforce Change: 18993 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
297ad73ebd
commit
d563928126
1 changed files with 42 additions and 15 deletions
|
|
@ -21,31 +21,22 @@ sub options {
|
|||
|
||||
sub requiredoptions {
|
||||
local ($pur, $missing, $report, $qa_opt) = ("", 0, "");
|
||||
local (@missopt);
|
||||
|
||||
foreach (@_) {
|
||||
unless (&getoption($_)) {
|
||||
if ($missing > 0) {
|
||||
$report = $report.",\n";
|
||||
}
|
||||
$missing = $missing + 1;
|
||||
$report = $report." MMQA_".$_;
|
||||
if (&optioncode($_)) {
|
||||
$qa_opt = &optioncode($_);
|
||||
$report = $report." (specify with -".$qa_opt.")";
|
||||
} elsif (&flagcode($_)) {
|
||||
$qa_opt = &flagcode($_);
|
||||
$report = $report." (set with -".$qa_opt."/-no".$qa_opt.")";
|
||||
} else {
|
||||
$report = $report." (but you can't set it -- oops!)";
|
||||
}
|
||||
push(@missopt, $_);
|
||||
}
|
||||
}
|
||||
if ($missing > 0) {
|
||||
if ($missing > 1) {
|
||||
$pur = "s";
|
||||
}
|
||||
die "Error: $qa_command requires the following option".
|
||||
$pur.":\n".$report.".\n";
|
||||
print "Error: $qa_command requires the following option".
|
||||
$pur.":\n";
|
||||
&explainoptions(@missopt);
|
||||
die "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,3 +117,39 @@ sub applydefaults {
|
|||
}
|
||||
}
|
||||
|
||||
sub explainoptions {
|
||||
local @keys = @_;
|
||||
local ($optname, $optcode, $optcur);
|
||||
|
||||
$~ = "OPTLIST";
|
||||
|
||||
print "\n";
|
||||
$optname = "OPTION";
|
||||
$optcode = "CODE";
|
||||
$optcur = "CURRENT";
|
||||
write;
|
||||
print "\n";
|
||||
|
||||
foreach $key (@keys) {
|
||||
$optname = "MMQA_$key";
|
||||
if (&optioncode($key)) {
|
||||
$optcode = "-".&optioncode($key)." <value>";
|
||||
} elsif (&flagcode($key)) {
|
||||
$optcode = "-[no]".&flagcode($key);
|
||||
} else {
|
||||
$optcode = "";
|
||||
}
|
||||
$optcur = (&getoption($key) || "");
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
sub displayalloptions {
|
||||
&explainoptions(values %qa_options, values %qa_flags);
|
||||
}
|
||||
|
||||
format OPTLIST =
|
||||
@<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
$optname, $optcode, $optcur
|
||||
.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue