@0x-jerry/silver
v1.1.1
Published
Let writing CLI like writing document.
Downloads
42
Readme
Silver
Let writing CLI like writing a document.
Install
pnpm i @0x-jerry/silver
Usage
Example:
import { silver } from '@0x-jerry/silver'
// @autocompletion will enable `completion` subcommand to generate autocomplete script
// Autocompletion only support zsh for now, and need to install manually
// Manual install: you need to append `source <(silver completion)` to `.zshrc`
const ins = sliver`
v1.0.0 @autocompletion
Silver, let you writing CLI like writing document. ${defaultAction}
-t --test @test:defaultValue, Test autocompletion.
up/upgrade <@test:dir> [...other] #stopEarly, an sub command. ${upgradeAction}
-s --string @string:default, sub command option.
--small @bool, other option.
`
// register autocomplete
ins.type('type', () => ['t1', 't2', 't3'])
function defaultAction([type], options) {
console.log(type, options)
}
function upgradeAction([dir], options) {
console.log(dir, options)
}
Syntax Detail
Please see syntax.ohm.