新版本
This commit is contained in:
commit
742b5bfe2d
509 files changed
+54763
No files matched your search
@@ -0,0 +1,38 @@
|
||||
// deno-lint-ignore no-import-prefix
|
||||
import { parse } from "https://deno.land/[email protected]/flags/mod.ts";
|
||||
import { match_sub_command_to_function } from "./cli/match.ts";
|
||||
|
||||
export const args = parse(Deno.args);
|
||||
export const cfg = await Deno.readTextFile(args.config ?? "./config.json").then(
|
||||
(text) => JSON.parse(text),
|
||||
);
|
||||
if (args.config) {
|
||||
console.debug(`Using config file: ${args.config}`);
|
||||
} else {
|
||||
console.debug(`Using default config file: ./config.json`);
|
||||
}
|
||||
|
||||
const homeDir = Deno.env.get("HOME") || Deno.env.get("USERPROFILE");
|
||||
for (const config of cfg.settings) {
|
||||
if (config.journal.from_directory.startsWith("~/")) {
|
||||
config.journal.from_directory = config.journal.from_directory.replace(
|
||||
"~",
|
||||
homeDir || "",
|
||||
);
|
||||
}
|
||||
if (config.pdf.signing.enabled) {
|
||||
if (config.pdf.signing.key_path.startsWith("~/")) {
|
||||
config.pdf.signing.key_path = config.pdf.signing.key_path.replace(
|
||||
"~",
|
||||
homeDir || "",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (import.meta.main) {
|
||||
await match_sub_command_to_function(
|
||||
args._ as Array<string>,
|
||||
args,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user