Generate alias for different command system, support zsh/bash
and Windows Command/PowerShell
.
# npm
npm install command-alias --save-dev
# yarn
yarn add command-alias --dev
# pnpm
pnpm add command-alias --save-dev
Using the following api will generate a few alias file under output directory throught alias.yaml
:
import { transform } from 'command-alias'
transform('alias.yaml', 'output')
type generateCommandAliasByPlugin = (
source: string,
outDir: string,
options?: Options
) => Promise<void>
type Options = {
filename?: string;
plugins?: string[];
}
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
- source file json example:
{
"part1": {
"sa": "short alias"
},
"part2": {
"saa": "short alias with optionA",
"sab": "short alias with optionB"
}
}
Alias output directory, all alias files will be placed under outDir.
Optional configs.
Define the output filename, default is alias
.
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
Install dependencies:
pnpm install
Make changes and run tests:
pnpm run test