Skip to content

Commit 856cbf2

Browse files
committed
Migrate UpdatePandocCommand from cliffy to clipanion
1 parent d64af63 commit 856cbf2

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

package/src/common/update-pandoc.ts

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
22
* update-pandoc.ts
33
*
4-
* Copyright (C) 2020-2022 Posit Software, PBC
4+
* Copyright (C) 2020-2024 Posit Software, PBC
55
*
66
*/
7-
import { Command } from "cliffy/command/mod.ts";
7+
import { Command, Option } from "npm:clipanion";
88
import { join } from "../../../src/deno_ral/path.ts";
99
import { ensureDirSync } from "../../../src/deno_ral/fs.ts";
1010
import { info } from "../../../src/deno_ral/log.ts";
@@ -13,7 +13,7 @@ import {
1313
Configuration,
1414
readConfiguration,
1515
withWorkingDir,
16-
} from "../common/config.ts";
16+
} from "./config.ts";
1717
import { lines } from "../../../src/core/text.ts";
1818
import { pandoc } from "./dependencies/pandoc.ts";
1919
import { archiveBinaryDependency } from "./archive-binary-dependencies.ts";
@@ -33,12 +33,17 @@ import {
3333

3434
import * as ld from "../../../src/core/lodash.ts";
3535

36-
export function updatePandoc() {
37-
return new Command()
38-
.name("update-pandoc")
39-
.arguments("<version:string>")
40-
.description("Updates Pandoc to the specified version")
41-
.action(async (_args, version: string) => {
36+
export class UpdatePandocCommand extends Command {
37+
static paths = [["update-pandoc"]];
38+
39+
static usage = Command.Usage({
40+
description: "Updates Pandoc to the specified version",
41+
});
42+
43+
version = Option.String();
44+
45+
async execute() {
46+
const { version } = this;
4247
info(`Updating Pandoc to ${version}`);
4348

4449
const configuration = readConfiguration();
@@ -85,7 +90,7 @@ export function updatePandoc() {
8590
console.log(bgBlack(brightWhite(bold(
8691
"\n** Remember to complete the checklist in /dev-docs/update-pandoc-checklist.md! **",
8792
))));
88-
});
93+
}
8994
}
9095

9196
// Starting in Pandoc 3, we saw a number of variants that appear to be supported

0 commit comments

Comments
 (0)