@p11-core/cli 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3628,9 +3628,13 @@ async function main() {
|
|
|
3628
3628
|
if (!isKnownTopLevelCommand(program2, command)) throw new Error(`Unknown command: ${command}`);
|
|
3629
3629
|
await program2.parseAsync(process.argv);
|
|
3630
3630
|
}
|
|
3631
|
-
function createCliProgram() {
|
|
3631
|
+
function createCliProgram(options = {}) {
|
|
3632
3632
|
const program2 = new Command();
|
|
3633
|
+
const warnBeforeAction = options.warnIfUpdateAvailable ?? warnIfUpdateAvailable;
|
|
3633
3634
|
program2.name("p11").description("Share and inspect p11 document pages.");
|
|
3635
|
+
program2.hook("preAction", async () => {
|
|
3636
|
+
await warnBeforeAction();
|
|
3637
|
+
});
|
|
3634
3638
|
program2.addHelpText(
|
|
3635
3639
|
"after",
|
|
3636
3640
|
`
|
|
@@ -3638,25 +3642,23 @@ function createCliProgram() {
|
|
|
3638
3642
|
Environment:
|
|
3639
3643
|
P11_API_URL Defaults to ${builtDefaultApiUrl}`
|
|
3640
3644
|
);
|
|
3641
|
-
const shareCommand = program2.command("share").description("Share a review link for a page.").argument("[page.tsx]").option("--json", "Print the API response as JSON.").option("--edit-url [url]", "Share a new version using an edit URL or edit id.").option("--api-url [url]", "Override the p11 API URL.").action(async (input,
|
|
3642
|
-
await
|
|
3643
|
-
await publish(input, normalizePublishOptions(options));
|
|
3645
|
+
const shareCommand = program2.command("share").description("Share a review link for a page.").argument("[page.tsx]").option("--json", "Print the API response as JSON.").option("--edit-url [url]", "Share a new version using an edit URL or edit id.").option("--api-url [url]", "Override the p11 API URL.").action(async (input, options2) => {
|
|
3646
|
+
await publish(input, normalizePublishOptions(options2));
|
|
3644
3647
|
});
|
|
3645
3648
|
allowLegacyParserBehavior(shareCommand);
|
|
3646
|
-
const commentsCommand = program2.command("comments").description("Fetch exported comments for a read/edit URL or id.").argument("[readUrl|editUrl|readId|editId]").option("--json", "Print comments as JSON.").option("--output [file]", "Write comments JSON to a file.").option("--version [n]", "Fetch comments for a specific page version.").option("--api-url [url]", "Override the p11 API URL.").action(async (target,
|
|
3647
|
-
await
|
|
3648
|
-
await comments(target, normalizeCommentsOptions(options));
|
|
3649
|
+
const commentsCommand = program2.command("comments").description("Fetch exported comments for a read/edit URL or id.").argument("[readUrl|editUrl|readId|editId]").option("--json", "Print comments as JSON.").option("--output [file]", "Write comments JSON to a file.").option("--version [n]", "Fetch comments for a specific page version.").option("--api-url [url]", "Override the p11 API URL.").action(async (target, options2) => {
|
|
3650
|
+
await comments(target, normalizeCommentsOptions(options2));
|
|
3649
3651
|
});
|
|
3650
3652
|
allowLegacyParserBehavior(commentsCommand);
|
|
3651
|
-
program2.command("history").description("List saved read/edit links.").option("--json", "Print saved history as JSON.").action(async (
|
|
3652
|
-
await history(normalizeHistoryOptions(
|
|
3653
|
+
program2.command("history").description("List saved read/edit links.").option("--json", "Print saved history as JSON.").action(async (options2) => {
|
|
3654
|
+
await history(normalizeHistoryOptions(options2));
|
|
3653
3655
|
});
|
|
3654
3656
|
const docsCommand = program2.command("docs").description("Print p11 authoring docs.").argument("[topic]", "Docs topic: components or sharing.").action(async (topic) => {
|
|
3655
3657
|
await docs(topic);
|
|
3656
3658
|
});
|
|
3657
3659
|
allowLegacyParserBehavior(docsCommand);
|
|
3658
|
-
const exampleCommand = program2.command("example").description("Print or write a p11 example document.").argument("[name]", "Example name: all-components.").option("--output [file]", "Write the example to a file.").action(async (name,
|
|
3659
|
-
await example(name, normalizeExampleOptions(
|
|
3660
|
+
const exampleCommand = program2.command("example").description("Print or write a p11 example document.").argument("[name]", "Example name: all-components.").option("--output [file]", "Write the example to a file.").action(async (name, options2) => {
|
|
3661
|
+
await example(name, normalizeExampleOptions(options2));
|
|
3660
3662
|
});
|
|
3661
3663
|
allowLegacyParserBehavior(exampleCommand);
|
|
3662
3664
|
return program2;
|
|
@@ -4432,6 +4434,7 @@ export {
|
|
|
4432
4434
|
buildPageModule,
|
|
4433
4435
|
commentsApiUrlForTarget,
|
|
4434
4436
|
commentsExportJson,
|
|
4437
|
+
createCliProgram,
|
|
4435
4438
|
isNewerVersion,
|
|
4436
4439
|
parseCommentsTarget,
|
|
4437
4440
|
parseEditId,
|