Commit 5c5e5ca29b20877614d9b1c025b86707e67e548b

Authored by Jay Berkenbilt
1 parent c8729398

Document how to add a command-line argument

README-maintainer
@@ -122,6 +122,31 @@ CODING RULES @@ -122,6 +122,31 @@ CODING RULES
122 since those have to get copied around a lot. 122 since those have to get copied around a lot.
123 123
124 124
  125 +HOW TO ADD A COMMAND-LINE ARGUMENT
  126 +
  127 +Command-line arguments are closely coupled with QPDFJob. To add a new
  128 +command-line argument, add the option to the appropriate table in
  129 +job.yml. This will automatically declare a method in the private
  130 +ArgParser class in QPDFJob_argv.cc which you have to implement. The
  131 +implementation should make calls to methods in QPDFJob.
  132 +
  133 +The build will fail until the new option is documented in
  134 +manual/cli.rst. To do that, create documentation for the option by
  135 +adding a ".. qpdf:option::" directive followed by a magic help comment
  136 +as described at the top of manual/cli.rst. Put this in the correct
  137 +help topic. Help topics roughly correspond with sections in that
  138 +chapter and are created using a special ".. help-topic" comment.
  139 +Follow the example of other options for style.
  140 +
  141 +When done, the following should happen:
  142 +
  143 +* qpdf --new-option should work as expected
  144 +* qpdf --help=--new-option should show the help from the comment in cli.rst
  145 +* qpdf --help=topic should list --new-option for the correct topic
  146 +* --new-option should appear in the manual
  147 +* --new-option should be in the command-line option index in the manual
  148 +
  149 +
125 RELEASE PREPARATION 150 RELEASE PREPARATION
126 151
127 * Each year, update copyright notices. This will find all relevant 152 * Each year, update copyright notices. This will find all relevant
job.sums
1 # Generated by generate_auto_job 1 # Generated by generate_auto_job
2 generate_auto_job 466aa9211549cebeb3fedc6413108981aeeddd89936621095f5f5223cee9880b 2 generate_auto_job 466aa9211549cebeb3fedc6413108981aeeddd89936621095f5f5223cee9880b
3 -job.yml 25c85cba1ae01dac9cd0f9cb7b734e7e3e531c0023ea2b892dc0d40bda1c1146 3 +job.yml 8177cadf41096efdc174f04daadfe5d98c592ad44ad10cb96537521fd79a801a
4 libqpdf/qpdf/auto_job_decl.hh 97395ecbe590b23ae04d6cce2080dbd0e998917ff5eeaa5c6aafa91041d3cd6a 4 libqpdf/qpdf/auto_job_decl.hh 97395ecbe590b23ae04d6cce2080dbd0e998917ff5eeaa5c6aafa91041d3cd6a
5 libqpdf/qpdf/auto_job_help.hh fa7ff1d1f6289881ac3a485107d15240c4992c59cff506be425354557108d184 5 libqpdf/qpdf/auto_job_help.hh fa7ff1d1f6289881ac3a485107d15240c4992c59cff506be425354557108d184
6 libqpdf/qpdf/auto_job_init.hh 465bf46769559ceb77110d1b9d3293ba9b3595850b49848c31aeabd10aadb4ad 6 libqpdf/qpdf/auto_job_init.hh 465bf46769559ceb77110d1b9d3293ba9b3595850b49848c31aeabd10aadb4ad
7 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d 7 manual/_ext/qpdf.py 855fe12de5af7a10bb24be6ecc4d5dff4c84ac58cf388a13be6bbb394346a67d
8 -manual/cli.rst c26e877d2065ac917edffdd6a037d2191b64d7c25beb4e8df1acc174b20b3ff4 8 +manual/cli.rst 7a36de7413b5c2867de573b5a9beff862e28c46123b72d08e3971ddf5bdf3bbe
  1 +# See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
1 choices: 2 choices:
2 yn: 3 yn:
3 - "y" 4 - "y"
libqpdf/QPDFJob_argv.cc
1 #include <qpdf/QPDFJob.hh> 1 #include <qpdf/QPDFJob.hh>
2 2
  3 +// See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
  4 +
3 #include <iostream> 5 #include <iostream>
4 #include <string.h> 6 #include <string.h>
5 #include <stdlib.h> 7 #include <stdlib.h>
manual/cli.rst
1 .. NOTES 1 .. NOTES
2 2
  3 + See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
  4 +
3 This file contains text that is used for help file generation. 5 This file contains text that is used for help file generation.
4 Lines that start with the magic comment ".. help topic x: y" 6 Lines that start with the magic comment ".. help topic x: y"
5 introduce a help topic called "x" with short text "y". The contents 7 introduce a help topic called "x" with short text "y". The contents
qpdf/qpdf.cc
@@ -43,6 +43,7 @@ int realmain(int argc, char* argv[]) @@ -43,6 +43,7 @@ int realmain(int argc, char* argv[])
43 bool errors = false; 43 bool errors = false;
44 try 44 try
45 { 45 {
  46 + // See "HOW TO ADD A COMMAND-LINE ARGUMENT" in README-maintainer.
46 j.initializeFromArgv(argc, argv); 47 j.initializeFromArgv(argc, argv);
47 j.run(); 48 j.run();
48 } 49 }