From 731017f63755496ad1ba7a6337e6bd2735604a2b Mon Sep 17 00:00:00 2001 From: jacoobes Date: Thu, 16 Feb 2023 12:07:16 -0600 Subject: [PATCH] feat: add more methods --- src/commands/plugins.ts | 9 ++++++++- src/index.ts | 17 +++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/commands/plugins.ts b/src/commands/plugins.ts index 719b774..70ad271 100644 --- a/src/commands/plugins.ts +++ b/src/commands/plugins.ts @@ -8,7 +8,8 @@ import { fromCwd } from '../utilities/fromCwd.js'; /** * Installs plugins to project */ -export async function plugins() { +export async function plugins(options: PluginOptions) { + console.log(options) const e: string[] = (await prompt([await pluginsQ()])).list; if (!e) process.exit(1); @@ -38,3 +39,9 @@ async function download(url: string) { } fs.writeFileSync(filedir, data); } + +interface PluginOptions { + name?: string; + save: boolean + +} diff --git a/src/index.ts b/src/index.ts index 4bc325f..5407c56 100644 --- a/src/index.ts +++ b/src/index.ts @@ -22,14 +22,15 @@ program .option('-s, --sync', 'Syncs the project and generates sern.config.json') .action(init); -program - .command(plugins.name) - .description( - 'Install plugins from https://github.com/sern-handler/awesome-plugins' - ) - .option('-n --name', 'Name of plugin') - .action(plugins); - +const pluginCommand = program.command(plugins.name) +pluginCommand + .description( + 'Get plugins from https://github.com/sern-handler/awesome-plugins' + ) + .option('-n --name', 'Name of plugin') + .option('-S --save', 'Save and keep plugins updated') + .action(plugins); + program .command(extra.name) .description('Easy way to add extra things in your sern project')