@gunshi/definition

utilities for gunshi command definition
This package exports the bellow APIs and types.
define: A function to define a command.
lazy: A function to lazily load a command.
- Some basic type definitions, such as
Command, LazyCommand, etc.
[!TIP]
The APIs and type definitions available in this package are the same as those in the gunshi/definition entry in the gunshi package.
This package is smaller in file size than the gunshi package, making it suitable for use when you want to reduce the size of the node_modules in your command you are creating.
💿 Installation
npm install --save @gunshi/definition
pnpm add @gunshi/definition
yarn add @gunshi/definition
deno add jsr:@gunshi/definition
bun add @gunshi/definition
🚀 Usage
You can define the gunshi command as JavaScript module with using define, defineWithTypes, lazy and lazyWithTypes
The bellow example case which is using define:
import { define } from '@gunshi/definition'
export default define({
name: 'say',
args: {
say: {
type: 'string',
description: 'say something',
default: 'hello!'
}
},
run: ctx => {
return `You said: ${ctx.values.say}`
}
})
About details, See the below official docs sections:
©️ License
MIT