import { Command, EnumType } from "jsr:@cliffy/command@1.0.0-rc.7"; import { buildPlugin } from "./cmd/build.ts"; import { bumpVersion } from "./cmd/bump.ts"; import { installPlugin } from "./cmd/install.ts"; import { uninstallPlugin } from "./cmd/uninstall.ts"; const bumpLevel = new EnumType(["patch", "minor", "major"]); await new Command() .name("obsideno") .version("1.0.0") .description("CLI helper for building Obsidian plugins") .globalOption( "-d, --plugin-dir ", "Root directory of your plugin. Defaults the directory where the command is run", ) // Build command .command("build", "Build your plugin with ESBuild") .option("-p, --production", "Minify and inline sourcemaps for production") .option("-w, --watch", "Watch for file changes and rebuild") // .action((args) => buildPlugin(args)) .action((args) => buildPlugin(args)) // Install command .command("install", "Build and install your plugin in the specified vault") .option("-p, --production", "Minify and inline sourcemaps for production") .arguments("") .action((args, path) => installPlugin(args, path)) // Uninstall command .command( "uninstall", "Removes your plugin from the specified vault. Omit the vault path to search your installation history", ) .option("-y, --yes", "Skip the confirmation step") .arguments("[vault-path]") .action((args, path) => uninstallPlugin(args, path)) // Version bump command .command("bump", "Bump your plugin version according to Semver") .type("bumpLevel", bumpLevel) .arguments("") .action((args, level) => bumpVersion(args, level)) .parse(Deno.args);