gunshi / default
default
gunshi cli entry point.
This entry point exports the bellow APIs and types:
cli
: The main CLI function to run the command, includedglobal options
andusage renderer
built-in plugins.define
: A function to define a command.lazy
: A function to lazily load a command.plugin
: A function to create a plugin.args-tokens
utilities,parseArgs
andresolveArgs
for parsing command line arguments.- Some basic type definitions, such as
CommandContext
,Plugin
,PluginContext
, etc.
Example
js
import { cli } from 'gunshi'
Variables
Variable | Description |
---|---|
ANONYMOUS_COMMAND_NAME | - |
Functions
Function | Description |
---|---|
cli | Run the command. |
parseArgs | Parse command line arguments. |
plugin | Define a plugin |
resolveArgs | Resolve command line arguments. |
Classes
Class | Description |
---|---|
DefaultTranslation | Default implementation of TranslationAdapter. |
Interfaces
Interface | Description |
---|---|
Args | An object that contains argument schema. |
ArgSchema | An argument schema definition for command-line argument parsing. |
ArgToken | Argument token. |
CliOptions | CLI options of cli function. |
Command | Command interface. |
CommandContext | Command context. Command context is the context of the command execution. |
CommandContextExtension | Command context extension |
CommandEnvironment | Command environment. |
GunshiParams | Gunshi unified parameter type. |
PluginContext | Gunshi plugin context interface. |
PluginDependency | Plugin dependency definition |
PluginOptions | Plugin definition options |
PluginWithExtension | Plugin return type with extension, which includes the plugin ID, name, dependencies, and extension. This type is used to define a plugin at plugin function. |
PluginWithoutExtension | Plugin return type without extension, which includes the plugin ID, name, and dependencies, but no extension. This type is used to define a plugin at plugin function without extension. |
RenderingOptions | Rendering control options |
References
define
Re-exports define
lazy
Re-exports lazy
Type Aliases
Type Alias | Description |
---|---|
ArgValues | An object that contains the values of the arguments. |
Awaitable | Awaitable type. |
Commandable | Define a command type. |
CommandCallMode | Command call mode. |
CommandContextCore | CommandContextCore type (base type without extensions) |
CommandDecorator | Command decorator. A function that wraps a command runner to add or modify its behavior. |
CommandExamplesFetcher | Command examples fetcher. |
CommandLoader | Command loader. A function that returns a command or command runner. This is used to lazily load commands. |
CommandRunner | Command runner. |
DefaultGunshiParams | Default Gunshi parameters. |
ExtendContext | Extend command context type. This type is used to extend the command context with additional properties at CommandContext.extensions. |
GunshiParamsConstraint | Generic constraint for command-related types. |
LazyCommand | Lazy command interface. Lazy command that's not loaded until it is executed. |
OnPluginExtension | Plugin extension callback, which is called when the plugin is extended with extension option. |
Plugin | Gunshi plugin, which is a function that receives a PluginContext. |
PluginExtension | Plugin extension |
PluginFunction | Plugin function type |
RendererDecorator | Renderer decorator type. A function that wraps a base renderer to add or modify its behavior. |
ValidationErrorsDecorator | Validation errors renderer decorator type. A function that wraps a validation errors renderer to add or modify its behavior. |