@x-toolkit/command-alias
v0.1.0
Published
[![npm version](https://img.shields.io/npm/v/@x-toolkit/command-alias.svg)](https://www.npmjs.com/package/@x-tookit/command-alias) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/x-toolkit/command-alias/CI) [![Coverage Status](http
Downloads
1
Readme
command-alias
Generate alias for different command system, support zsh/bash
and Windows Command/PowerShell
.
Usage
Installation
# npm
npm install @x-toolkit/command-alias --save-dev
# yarn
yarn add @x-toolkit/command-alias --dev
# pnpm
pnpm add @x-toolkit/command-alias --save-dev
Api
Using the following api will generate a few alias file under output directory throught alias.yaml
:
import { generateCommandAliasByPlugin } from '@x-toolkit/command-alias'
generateCommandAliasByPlugin('alias.yaml', 'output')
Params
type generateCommandAliasByPlugin = (
source: string,
outDir: string,
options?: Options
) => Promise<void>
type Options = {
filename?: string;
plugins?: string[];
}
source
Alias config filepath, support json/yaml
format.
Source file yaml example:
part1:
sa: short alias
part2:
saa: short alias with optionA
sab: short alias with optionB
outDir
Alias output directory, all alias files will be placed under outDir.
options
Optional configs.
options.filename
Define the output filename, default is alias
.
options.plugins
Define the using plugins to generate, without specifying will use all plugins by default.
Support options:
sh
: for bash-like command, likezsh/bash
bat
: forWindows Command
ps1
: forWindows PowerShell
Development
Install dependencies:
pnpm install
Make changes and run tests:
pnpm run test