-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.ts
More file actions
38 lines (37 loc) · 1.44 KB
/
mod.ts
File metadata and controls
38 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Command } from "jsr:@cliffy/command@1.0.0-rc.7";
import { cloneFromAPI } from "./cosenseCodeClone.ts";
import { cloneFromJSON } from "./fromJSON.ts";
export { cloneFromAPI, cloneFromJSON };
if (import.meta.main) {
const clone = new Command()
.arguments("<projectName:string> [destination:string]")
.description(
"fetch scrapbox project specified in projectName and clone code and pages to destination(not specified is to ./projectName/).",
)
.action((_options, projectName, destination_) => {
const destination = destination_ ? destination_ : projectName;
cloneFromAPI("clone", projectName, destination);
});
const pull = new Command()
.arguments("<projectName:string> [destination:string]")
.description(
"equvialent to clone, but fetch changed pages only. and deleted pages in cosense is not deleted in file.",
)
.action((_options, projectName, destination_) => {
const destination = destination_ ? destination_ : projectName;
cloneFromAPI("pull", projectName, destination);
});
const json = new Command()
.arguments("<fileName:string> <destination:string>")
.description(
"generate html and codeblocks file from cosense json.",
)
.action((_options, fileName, destination) => {
cloneFromJSON(fileName, destination);
});
await new Command()
.command("clone", clone)
.command("pull", pull)
.command("json", json)
.parse(Deno.args);
}