@gunshi/definition
v0.29.5
Published
utilities for gunshi command definition
Readme
@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/definitionentry in thegunshipackage. This package is smaller in file size than thegunshipackage, making it suitable for use when you want to reduce the size of thenode_modulesin your command you are creating.
💿 Installation
# npm
npm install --save @gunshi/definition
## pnpm
pnpm add @gunshi/definition
## yarn
yarn add @gunshi/definition
## deno
deno add jsr:@gunshi/definition
## bun
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'
/**
* define `say` command as javascript module
*/
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:
- Essentials:
Advanced:
