Skip to content

gunshi / definition

definition ​

The entry for gunshi command definition.

This entry point exports the following APIs and types:

  • define: A function to define a command.
  • defineWithTypes: A function to define a command with specific type parameters.
  • lazy: A function to lazily load a command.
  • lazyWithTypes: A function to lazily load a command with specific type parameters.
  • Some basic type definitions, such as Command, LazyCommand, etc.

Example ​

js
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}`
  }
})

Functions ​

FunctionDescription
defineDefine a command.
defineWithTypesDefine a command with types
lazyDefine a lazy command with or without definition.
lazyWithTypesDefine a lazy command with specific type parameters.

References ​

Args ​

Re-exports Args


ArgSchema ​

Re-exports ArgSchema


ArgValues ​

Re-exports ArgValues


Command ​

Re-exports Command


CommandContextParams ​

Re-exports CommandContextParams


CommandLoader ​

Re-exports CommandLoader


CommandRunner ​

Re-exports CommandRunner


createCommandContext ​

Re-exports createCommandContext


DefaultGunshiParams ​

Re-exports DefaultGunshiParams


ExtendContext ​

Re-exports ExtendContext


GunshiParams ​

Re-exports GunshiParams


LazyCommand ​

Re-exports LazyCommand

Released under the MIT License.