diff --git a/src/commands/sync.ts b/src/commands/sync.ts new file mode 100644 index 0000000..8290515 --- /dev/null +++ b/src/commands/sync.ts @@ -0,0 +1,15 @@ +import { syncIcons } from "../utils/generateIcon"; +import { loadConfig } from "../utils/config"; + +export const sync = async () => { + try { + const config = await loadConfig(); + await syncIcons(config); + } catch (error) { + if (error instanceof Error) { + console.error(error.message); + } else { + console.error(error); + } + } +}; diff --git a/src/index.ts b/src/index.ts index c3a9775..f68da35 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,6 +5,7 @@ import { program } from "commander"; import pc from "picocolors"; import { init } from "./commands/init"; import { add } from "./commands/add"; +import { sync } from "./commands/sync"; program.version( [ @@ -25,4 +26,9 @@ program .argument("", "The name of the icon to add") .action(add); +program + .command("sync") + .description("Sync the icons to the project") + .action(sync); + program.parse();