|
13 | 13 | * See the License for the specific language governing permissions and |
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | | -package org.opendataloader.pdf.cli; |
| 16 | +package org.opendataloader.pdf.api.cli; |
17 | 17 |
|
18 | 18 | import org.apache.commons.cli.CommandLine; |
19 | 19 | import org.apache.commons.cli.Option; |
|
30 | 30 | import java.util.Set; |
31 | 31 | import java.util.stream.Collectors; |
32 | 32 |
|
| 33 | +/** |
| 34 | + * Adapter that maps Apache Commons CLI options to {@link Config} / {@link HybridConfig}. |
| 35 | + * |
| 36 | + * <p><b>Stable API for downstream tools</b> (e.g. opendataloader-pdfua) — these four |
| 37 | + * members are the supported integration surface and will not break compatibly: |
| 38 | + * <ul> |
| 39 | + * <li>{@link #defineOptions()} — get a fully populated {@code Options} instance</li> |
| 40 | + * <li>{@link #addAllTo(Options)} — add core options into an externally-built {@code Options}</li> |
| 41 | + * <li>{@link #applyAllTo(Config, CommandLine)} — populate a {@code Config} from a parsed line</li> |
| 42 | + * <li>{@link #FOLDER_OPTION} — short option name for {@code --output-dir}</li> |
| 43 | + * </ul> |
| 44 | + * |
| 45 | + * <p><b>Everything else is internal.</b> The numerous other public {@code static} members |
| 46 | + * (option-name constants, helpers like {@code createConfigFromCommandLine}, |
| 47 | + * {@code exportOptionsAsJson}) exist for the CLI module ({@code CLIMain}) and the |
| 48 | + * options-export tooling that drives Node/Python binding generation. Their visibility |
| 49 | + * is {@code public} only for cross-package access within this codebase; they are |
| 50 | + * <i>not</i> part of the supported API and may be renamed, moved, or removed in any |
| 51 | + * release. Downstream consumers depending on them do so at their own risk. |
| 52 | + * |
| 53 | + * <p>Pdfua's usage pattern (build your own {@code Options}, add core's, parse, then |
| 54 | + * populate {@code Config}): |
| 55 | + * <pre>{@code |
| 56 | + * Options options = new Options(); |
| 57 | + * options.addOption(...); // your tool-specific options |
| 58 | + * CLIOptions.addAllTo(options); // add core's options |
| 59 | + * CommandLine cmd = parser.parse(options, args); |
| 60 | + * Config core = new Config(); |
| 61 | + * CLIOptions.applyAllTo(core, cmd); |
| 62 | + * }</pre> |
| 63 | + */ |
33 | 64 | public class CLIOptions { |
34 | 65 |
|
35 | 66 | // ===== Output Directory ===== |
|
0 commit comments