mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Tools(listFontWithLang.pl): Group related parameters in the command syntax
Display sequence of command parameters according to their appearance in the definition table
This commit is contained in:
parent
f2243a3bc7
commit
36deaaac26
@ -51,11 +51,22 @@ my $helpFormat = " %-8s|%-9s|%-7s|%-17s|%s\n";
|
||||
|
||||
sub handleOptions($)
|
||||
{
|
||||
if (ref($_[0]) eq "ARRAY") {
|
||||
for (my $i = 0; defined($_[0]->[$i]); $i++) {
|
||||
my $rO = $_[0]->[$i];
|
||||
$optionsDef{$rO->[0]} = $rO->[1];
|
||||
$optionsDef{$rO->[0]}->{Sort} = $i+1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
%optionsDef = %{$_[0]};
|
||||
}
|
||||
$optionsDef{h}->{fieldname} = "help";
|
||||
$optionsDef{h}->{alias} = ["help"];
|
||||
$optionsDef{h}->{Sort} = 0;
|
||||
$optionsDef{v}->{fieldname} = "verbose";
|
||||
$optionsDef{v}->{alias} = ["verbose"];
|
||||
$optionsDef{v}->{Sort} = 0;
|
||||
|
||||
my %options = ("help" => 0);
|
||||
my $opts = &makeOpts();
|
||||
@ -142,7 +153,7 @@ sub makeHelp()
|
||||
"i" => "integer",
|
||||
"f" => "float",
|
||||
);
|
||||
for my $ex (sort keys %optionsDef) {
|
||||
for my $ex (sort {$optionsDef{$a}->{Sort} <=> $optionsDef{$b}->{Sort};} keys %optionsDef) {
|
||||
my $e = $optionsDef{$ex};
|
||||
my $type = "";
|
||||
my $needed = "";
|
||||
|
@ -48,43 +48,56 @@ sub correctstyle($);
|
||||
# alias: reference to a list of aliases e.g. ["alias1", "alias2", ... ]
|
||||
# listsep: Separator for multiple data
|
||||
# comment: Parameter description
|
||||
my %optionsDef = (
|
||||
my @optionsDef = (
|
||||
# help + verbose already handled in 'GetOptions'
|
||||
"l" => {fieldname => "Lang",
|
||||
type => "=s", alias=>["lang"],
|
||||
comment => "Comma separated list of desired languages"},
|
||||
"math" => {fieldname => "Math",
|
||||
comment => "Select fonts probably containing math glyphs"},
|
||||
"n" => {fieldname => "FontName", listsep => ',',
|
||||
["n",
|
||||
{fieldname => "FontName", listsep => ',',
|
||||
type => "=s", alias => ["name"],
|
||||
comment => "Select font-names matching these (comma separated) regexes"},
|
||||
"nn" => {fieldname => "NFontName",
|
||||
comment => "Select font-names matching these (comma separated) regexes"},],
|
||||
["nn",
|
||||
{fieldname => "NFontName",
|
||||
type => "=s", listsep => ',',
|
||||
comment => "Select font-names NOT matching these (comma separated) regexes"},
|
||||
"pl" => {fieldname => "PrintLangs", alias => ["printlangs"],
|
||||
comment => "Print supported languages"},
|
||||
"pf" => {fieldname => "PrintFiles", alias => ["printfiles"],
|
||||
comment => "Print font file names"},
|
||||
"p" => {fieldname => "Property",
|
||||
comment => "Select font-names NOT matching these (comma separated) regexes"},],
|
||||
["p",
|
||||
{fieldname => "Property",
|
||||
type => "=s", listsep => ',',
|
||||
comment => "Select fonts with properties matching these (comma separated) regexes"},
|
||||
"np" => {fieldname => "NProperty",
|
||||
comment => "Select fonts with properties matching these (comma separated) regexes"},],
|
||||
["np",
|
||||
{fieldname => "NProperty",
|
||||
type => "=s", listsep => ',',
|
||||
comment => "Select fonts with properties NOT matching these (comma separated) regexes"},
|
||||
"pp" => {fieldname => "PrintProperties", alias => ["printproperties"],
|
||||
comment => "Print properties from weight, slant and width"},
|
||||
"s" => {fieldname => "Scripts",
|
||||
comment => "Select fonts with properties NOT matching these (comma separated) regexes"},],
|
||||
["s",
|
||||
{fieldname => "Scripts",
|
||||
type => "=s", listsep => ',',
|
||||
comment => "Select fonts with scripts matching these (comma separated) regexes"},
|
||||
"ns" => {fieldname => "NScripts",
|
||||
comment => "Select fonts with scripts matching these (comma separated) regexes"},],
|
||||
["ns",
|
||||
{fieldname => "NScripts",
|
||||
type => "=s", listsep => ',',
|
||||
comment => "Select fonts with scripts NOT matching these (comma separated) regexes"},
|
||||
"ps" => {fieldname => "PrintScripts", alias => ["printscripts"],
|
||||
comment => "Print supported scripts"},
|
||||
"pw" => {fieldname => "PrintWarnings",
|
||||
comment => "Print warnings about discarded/overwritten fonts, conflicting styles"},
|
||||
comment => "Select fonts with scripts NOT matching these (comma separated) regexes"},],
|
||||
["math",
|
||||
{fieldname => "Math",
|
||||
comment => "Select fonts probably containing math glyphs"},],
|
||||
["l",
|
||||
{fieldname => "Lang",
|
||||
type => "=s", alias=>["lang"],
|
||||
comment => "Comma separated list of desired languages"},],
|
||||
["pl",
|
||||
{fieldname => "PrintLangs", alias => ["printlangs"],
|
||||
comment => "Print supported languages"},],
|
||||
["pp",
|
||||
{fieldname => "PrintProperties", alias => ["printproperties"],
|
||||
comment => "Print properties from weight, slant and width"},],
|
||||
["ps",
|
||||
{fieldname => "PrintScripts", alias => ["printscripts"],
|
||||
comment => "Print supported scripts"},],
|
||||
["pf",
|
||||
{fieldname => "PrintFiles", alias => ["printfiles"],
|
||||
comment => "Print font file names"},],
|
||||
["pw",
|
||||
{fieldname => "PrintWarnings",
|
||||
comment => "Print warnings about discarded/overwritten fonts, conflicting styles"},],
|
||||
);
|
||||
my %options = %{&handleOptions(\%optionsDef)};
|
||||
my %options = %{&handleOptions(\@optionsDef)};
|
||||
|
||||
$options{Lang} = "" if (! defined($options{Lang}));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user