gunshi / default
default
The main entry point for Gunshi.
Example
js
import { cli } from 'gunshi'
Variables
Variable | Description |
---|---|
DEFAULT_LOCALE | The default locale string, which format is BCP 47 language tag. |
Functions
Function | Description |
---|---|
cli | Run the command. |
parseArgs | Parse command line arguments. |
plugin | Create a plugin with extension capabilities |
resolveArgs | Resolve command line arguments. |
Classes
Class | Description |
---|---|
DefaultTranslation | Translation adapter. This adapter is used to custom message formatter like Intlify message format, `Intl.MessageFormat` (MF2), and etc. This adapter will support localization with your preferred message format. |
Interfaces
Interface | Description |
---|---|
Args | An object that contains argument schema. |
ArgSchema | An argument schema This schema is similar to the schema of the node:utils . difference is that: - required property and description property are added - type is not only 'string' and 'boolean', but also 'number', 'enum', 'positional', 'custom' too. - default property type, not support multiple types |
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. This type combines both argument definitions and command context extensions. |
PluginOptions | Plugin definition options |
TranslationAdapter | Translation adapter. This adapter is used to custom message formatter like Intlify message format, `Intl.MessageFormat` (MF2), and etc. This adapter will support localization with your preferred message format. |
TranslationAdapterFactoryOptions | Translation adapter factory 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 | - |
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. |
CommandResource | Command resource. |
CommandResourceFetcher | Command resource fetcher. |
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. |
LazyCommand | Lazy command interface. Lazy command that's not loaded until it is executed. |
Plugin | Gunshi plugin, which is a function that receives a PluginContext. |
PluginExtension | Plugin extension for CommandContext |
RendererDecorator | Renderer decorator type. A function that wraps a base renderer to add or modify its behavior. |
TranslationAdapterFactory | Translation adapter factory. |
ValidationErrorsDecorator | Validation errors renderer decorator type. A function that wraps a validation errors renderer to add or modify its behavior. |