Something went wrong. Try again.
CLI tool to sync your Markdown to Leaflet
leafletpub atproto cli markdown
Something went wrong. Try again.
1.5 kB · 51 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152import { defineCommand, renderUsage, runMain } from "citty";import consola from "consola";import { colorize } from "consola/utils";import { configCmd } from "./commands/config-cmd.ts";import { syncCmd } from "./commands/sync-cmd.ts";import { filesCmd } from "./commands/files-cmd.ts";import { version } from "../package.json" with { type: "json" };
import dotenv from "dotenv";import { isBun, isCI } from "std-env";if (!isBun) dotenv.config({ quiet: true });
const consolaOptions = consola.options;consolaOptions.formatOptions.date = false;consola.options = consolaOptions;
export let noKeyring = false;
const main = defineCommand({ meta: { name: "leaflet-md", version: version, description: "CLI tool to transplant (sync) your Markdown to Leaflet ", }, subCommands: { sync: syncCmd, config: configCmd, files: filesCmd, }, args: { nokeyring: { type: "boolean", description: "Disables saving and restoring of auth session." }, }, setup: (ctx) => { noKeyring = ctx.args.nokeyring || isCI; },});
runMain(main, { async showUsage(cmd, parent) { consola.log( colorize("green", colorize("bold", "Leaflet MD")) + " | " + colorize("dim", "CLI tool to transplant (sync) your Markdown to Leaflet") );
const defaultUsage = await renderUsage(cmd, parent); const usageSplit = defaultUsage.split("\n");
consola.log(usageSplit.slice(1, usageSplit.length).join("\n")); },});