aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-02-07 14:07:09 +0100
committerJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-02-07 18:49:24 +0100
commit3e98fe46a24d8231ed5f962f5b874032e4994f08 (patch)
tree724d540b2c7f1b0d5dcdb184b6a7dd01f3b2f319 /examples
parent4fd619818c30fb55b144675d3e5d2c83728e6976 (diff)
downloadqpdf-3e98fe46a24d8231ed5f962f5b874032e4994f08.tar.zst
Tidy example CLI usage
Change "-" to "--" for named parameters. Remove spaces inside "[ option ]" for optional parameters. Fix "pdf-mod-info --dump file" to match usage message.
Diffstat (limited to 'examples')
-rw-r--r--examples/pdf-bookmarks.cc16
-rw-r--r--examples/pdf-custom-filter.cc2
-rw-r--r--examples/pdf-mod-info.cc15
-rw-r--r--examples/qtest/bookmarks.test6
-rw-r--r--examples/qtest/bookmarks/test.--show-open.--lines.out (renamed from examples/qtest/bookmarks/test.-show-open.-lines.out)0
-rw-r--r--examples/qtest/bookmarks/test.--show-open.--numbers.out (renamed from examples/qtest/bookmarks/test.-show-open.-numbers.out)0
-rw-r--r--examples/qtest/bookmarks/test.--show-open.x.out (renamed from examples/qtest/bookmarks/test.-show-open.x.out)0
-rw-r--r--examples/qtest/bookmarks/test.x.--lines.out (renamed from examples/qtest/bookmarks/test.x.-lines.out)0
-rw-r--r--examples/qtest/bookmarks/test.x.--numbers.out (renamed from examples/qtest/bookmarks/test.x.-numbers.out)0
-rw-r--r--examples/qtest/mod-info.test28
-rw-r--r--examples/qtest/mod-info/usage.out2
11 files changed, 34 insertions, 35 deletions
diff --git a/examples/pdf-bookmarks.cc b/examples/pdf-bookmarks.cc
index 20a93078..d4501728 100644
--- a/examples/pdf-bookmarks.cc
+++ b/examples/pdf-bookmarks.cc
@@ -22,13 +22,13 @@ void usage()
std::cerr << "Usage: " << whoami << " [options] file.pdf [password]"
<< std::endl
<< "Options:" << std::endl
- << " -numbers give bookmarks outline-style numbers"
+ << " --numbers give bookmarks outline-style numbers"
<< std::endl
- << " -lines draw lines to show bookmark hierarchy"
+ << " --lines draw lines to show bookmark hierarchy"
<< std::endl
- << " -show-open indicate whether a bookmark is initially open"
+ << " --show-open indicate whether a bookmark is initially open"
<< std::endl
- << " -show-targets show target if possible"
+ << " --show-targets show target if possible"
<< std::endl;
exit(2);
}
@@ -177,19 +177,19 @@ int main(int argc, char* argv[])
{
if (argv[arg][0] == '-')
{
- if (strcmp(argv[arg], "-numbers") == 0)
+ if (strcmp(argv[arg], "--numbers") == 0)
{
style = st_numbers;
}
- else if (strcmp(argv[arg], "-lines") == 0)
+ else if (strcmp(argv[arg], "--lines") == 0)
{
style = st_lines;
}
- else if (strcmp(argv[arg], "-show-open") == 0)
+ else if (strcmp(argv[arg], "--show-open") == 0)
{
show_open = true;
}
- else if (strcmp(argv[arg], "-show-targets") == 0)
+ else if (strcmp(argv[arg], "--show-targets") == 0)
{
show_targets = true;
}
diff --git a/examples/pdf-custom-filter.cc b/examples/pdf-custom-filter.cc
index ea08de3a..a958a782 100644
--- a/examples/pdf-custom-filter.cc
+++ b/examples/pdf-custom-filter.cc
@@ -461,7 +461,7 @@ static void usage()
{
std::cerr
<< "\n"
- << "Usage: " << whoami << " [ --decode-specialized ] infile outfile\n"
+ << "Usage: " << whoami << " [--decode-specialized] infile outfile\n"
<< std::endl;
exit(2);
}
diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc
index 55b0c8c4..20f13a7a 100644
--- a/examples/pdf-mod-info.cc
+++ b/examples/pdf-mod-info.cc
@@ -17,7 +17,7 @@ void usage()
{
std::cerr
<< "Usage: " << whoami
- << " -in in_file [-out out_file] [-key key [-val val]?]+\n"
+ << " --in in_file [--out out_file] [--key key [--val val]?]+\n"
<< "Modifies/Adds/Removes PDF /Info entries in the in_file\n"
<< "and stores the result in out_file\n"
<< "Special mode: " << whoami << " --dump file\n"
@@ -86,11 +86,10 @@ int main(int argc, char* argv[])
std::cout << whoami << " version " << version << std::endl;
exit(0);
}
- if ((argc == 4) && (! strcmp(argv[1], "--dump")) &&
- (strcmp(argv[2], "-in") == 0) )
+ if ((argc == 3) && (! strcmp(argv[1], "--dump")))
{
QTC::TC("examples", "pdf-mod-info --dump");
- pdfDumpInfoDict(argv[3]);
+ pdfDumpInfoDict(argv[2]);
exit(0);
}
@@ -100,11 +99,11 @@ int main(int argc, char* argv[])
for (int i = 1; i < argc; ++i)
{
- if ((! strcmp(argv[i], "-in")) && (++i < argc))
+ if ((! strcmp(argv[i], "--in")) && (++i < argc))
{
fl_in = argv[i];
}
- else if ((! strcmp(argv[i], "-out")) && (++i < argc))
+ else if ((! strcmp(argv[i], "--out")) && (++i < argc))
{
fl_out = argv[i];
}
@@ -112,7 +111,7 @@ int main(int argc, char* argv[])
{
static_id = true; // this should be used in test suites only
}
- else if ((! strcmp(argv[i], "-key")) && (++i < argc))
+ else if ((! strcmp(argv[i], "--key")) && (++i < argc))
{
QTC::TC("examples", "pdf-mod-info -key");
cur_key = argv[i];
@@ -122,7 +121,7 @@ int main(int argc, char* argv[])
}
Keys[cur_key] = "";
}
- else if ((! strcmp(argv[i], "-val")) && (++i < argc))
+ else if ((! strcmp(argv[i], "--val")) && (++i < argc))
{
if (cur_key.empty())
{
diff --git a/examples/qtest/bookmarks.test b/examples/qtest/bookmarks.test
index 395357e3..cff8fc60 100644
--- a/examples/qtest/bookmarks.test
+++ b/examples/qtest/bookmarks.test
@@ -9,9 +9,9 @@ require TestDriver;
my $td = new TestDriver('pdf-bookmarks');
-foreach my $show ("", " -show-open")
+foreach my $show ("", " --show-open")
{
- foreach my $style ("", " -lines", " -numbers")
+ foreach my $style ("", " --lines", " --numbers")
{
my $xshow = $show ? $show : "x";
my $xstyle = $style ? $style : "x";
@@ -37,7 +37,7 @@ $td->runtest("bad",
$td->NORMALIZE_NEWLINES);
$td->runtest("encrypted, targets",
- {$td->COMMAND => "pdf-bookmarks -show-targets 4.pdf user"},
+ {$td->COMMAND => "pdf-bookmarks --show-targets 4.pdf user"},
{$td->FILE => "encrypted.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
diff --git a/examples/qtest/bookmarks/test.-show-open.-lines.out b/examples/qtest/bookmarks/test.--show-open.--lines.out
index ea66669c..ea66669c 100644
--- a/examples/qtest/bookmarks/test.-show-open.-lines.out
+++ b/examples/qtest/bookmarks/test.--show-open.--lines.out
diff --git a/examples/qtest/bookmarks/test.-show-open.-numbers.out b/examples/qtest/bookmarks/test.--show-open.--numbers.out
index 3680c2d4..3680c2d4 100644
--- a/examples/qtest/bookmarks/test.-show-open.-numbers.out
+++ b/examples/qtest/bookmarks/test.--show-open.--numbers.out
diff --git a/examples/qtest/bookmarks/test.-show-open.x.out b/examples/qtest/bookmarks/test.--show-open.x.out
index 46667ef7..46667ef7 100644
--- a/examples/qtest/bookmarks/test.-show-open.x.out
+++ b/examples/qtest/bookmarks/test.--show-open.x.out
diff --git a/examples/qtest/bookmarks/test.x.-lines.out b/examples/qtest/bookmarks/test.x.--lines.out
index a6de7db5..a6de7db5 100644
--- a/examples/qtest/bookmarks/test.x.-lines.out
+++ b/examples/qtest/bookmarks/test.x.--lines.out
diff --git a/examples/qtest/bookmarks/test.x.-numbers.out b/examples/qtest/bookmarks/test.x.--numbers.out
index 7ff9e2aa..7ff9e2aa 100644
--- a/examples/qtest/bookmarks/test.x.-numbers.out
+++ b/examples/qtest/bookmarks/test.x.--numbers.out
diff --git a/examples/qtest/mod-info.test b/examples/qtest/mod-info.test
index 145bf133..5f927170 100644
--- a/examples/qtest/mod-info.test
+++ b/examples/qtest/mod-info.test
@@ -16,64 +16,64 @@ my $qpdf = $ENV{'QPDF_BIN'} or die;
cleanup();
$td->runtest("usage #1",
- {$td->COMMAND => "$prg -in target.pdf"},
+ {$td->COMMAND => "$prg --in target.pdf"},
{$td->FILE => "usage.out",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("usage #2",
- {$td->COMMAND => "$prg -key abc -val def"},
+ {$td->COMMAND => "$prg --key abc --val def"},
{$td->FILE => "usage.out",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("usage #3",
- {$td->COMMAND => "$prg -key abc -val def abc"},
+ {$td->COMMAND => "$prg --key abc --val def abc"},
{$td->FILE => "usage.out",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("usage #4",
- {$td->COMMAND => "$prg -in source1.pdf -key date -val 01/01/01 -val 12/12/12"},
+ {$td->COMMAND => "$prg --in source1.pdf --key date --val 01/01/01 --val 12/12/12"},
{$td->FILE => "usage.out",
$td->EXIT_STATUS => 2},
$td->NORMALIZE_NEWLINES);
$td->runtest("dump #1",
- {$td->COMMAND => "$prg --dump -in files/source1.pdf"},
+ {$td->COMMAND => "$prg --dump files/source1.pdf"},
{$td->FILE => "dump.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("dump #2",
- {$td->COMMAND => "$prg --dump -in files/no-info.pdf"},
+ {$td->COMMAND => "$prg --dump files/no-info.pdf"},
{$td->STRING => "",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("dump #3",
- {$td->COMMAND => "$prg --dump -in files/empty-info.pdf"},
+ {$td->COMMAND => "$prg --dump files/empty-info.pdf"},
{$td->STRING => "",
$td->EXIT_STATUS => 0});
run_and_cmp("modify Subject",
- "$prg -in files/source1.pdf -out out.pdf -key Subject " .
- "-val \"Export Business\"",
+ "$prg --in files/source1.pdf --out out.pdf --key Subject " .
+ "--val \"Export Business\"",
"", "out.pdf", "files/1.qdf");
run_and_cmp("add Subject, remove Producer, modify CreationDate",
- "$prg -in files/source2.pdf -out out.pdf -key Subject " .
- "-val \"Tammlin\" -key Producer -key CreationDate -val 12/12",
+ "$prg --in files/source2.pdf --out out.pdf --key Subject " .
+ "--val \"Tammlin\" --key Producer --key CreationDate --val 12/12",
"", "out.pdf", "files/2.qdf");
run_and_cmp("add Subject (empty-info file)",
- "$prg -in files/empty-info.pdf -out out.pdf -key Subject " .
- "-val Tammlin",
+ "$prg --in files/empty-info.pdf --out out.pdf --key Subject " .
+ "--val Tammlin",
"", "out.pdf", "files/3.qdf");
copy("files/no-info.pdf", "no-info.pdf") or die "can't copy no-info: $!";
run_and_cmp("in-place Producer added (no-info file)",
- "$prg -in no-info.pdf -key Producer -val \"Obivan Kinobi\"",
+ "$prg --in no-info.pdf --key Producer --val \"Obivan Kinobi\"",
"", "no-info.pdf", "files/4.qdf");
cleanup();
diff --git a/examples/qtest/mod-info/usage.out b/examples/qtest/mod-info/usage.out
index 5eeba82e..13ac3b20 100644
--- a/examples/qtest/mod-info/usage.out
+++ b/examples/qtest/mod-info/usage.out
@@ -1,4 +1,4 @@
-Usage: pdf-mod-info -in in_file [-out out_file] [-key key [-val val]?]+
+Usage: pdf-mod-info --in in_file [--out out_file] [--key key [--val val]?]+
Modifies/Adds/Removes PDF /Info entries in the in_file
and stores the result in out_file
Special mode: pdf-mod-info --dump file