diff --git a/README.md b/README.md new file mode 100644 index 0000000..8421f36 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Sern CLI + +Our CLI allows you to setup and manage Discord bot projects without writing a single line of code! + +😁 **User Friendly**
+💦 **Simple**
+🌱 **Efficient**
+💪 **Powerful**
+ +## Installation + +```sh +npm install -g @sern/cli@latest +``` + +```sh +yarn add -g @sern/cli@latest +``` + +```sh +pnpm add -g @sern/cli@latest +``` + +## Getting Started + +When you install the CLI, you can use our commands with **sern** prefix. + +`sern (opt)` + + +## Setting Up Your Project + +#### TODO diff --git a/src/commands/help.js b/src/commands/help.js index 21877f5..3aaf857 100644 --- a/src/commands/help.js +++ b/src/commands/help.js @@ -1,3 +1,6 @@ -export function help() { +import { version } from '../utilities/version.js'; + +export function help({ flags }) { + if (flags?.includes('v') || flags?.includes('version')) return version(); console.log('This is the Sern CLI help section.\n\n' + 'Fill me up later!'); } diff --git a/src/index.js b/src/index.js index 794aa3a..65453c1 100644 --- a/src/index.js +++ b/src/index.js @@ -13,7 +13,7 @@ const args = rawArgs .split(/ +/) .filter((e) => !/(--|-)\w+/gm.test(e)); -const cmdName = args[0]; +const cmdName = args[0] || ''; const commands = new Map([ ['help', help], diff --git a/src/utilities/version.js b/src/utilities/version.js new file mode 100644 index 0000000..ce32ba8 --- /dev/null +++ b/src/utilities/version.js @@ -0,0 +1,7 @@ +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); +const { version: v } = require('../../package.json'); + +export function version() { + console.log(`SernHandler CLI v${v}`); +}