Releases: lukeed/sade
v1.8.1
v1.8.0
Features
-
Add initial Deno support (#48): 5ebb94c
Available viadeno.land/x/sade
Thank you @ryanccn~! -
Add
"module"
for bundler-friendly ESM (#51): cb05689
Buildslib/*
from source using Rollup and Terser. Retains full Node 6.x support -
Add TypeScript definitions: 9171cbf
Sade now includes its own TypeScript definitions directly.
If coming from the@types/sade
package, you may now type youraction()
arguments strictly:sade('hello') .command('foobar <name> [age]', 'asd', { default: true }) .action<[string, number|null]>((name, age, options) => { name.length; // ^? type: string age // ^? type: number | null options // ^? type: mri.Argv<Default> }) // ...
Full Changelog: v1.7.4...v1.8.0
v1.7.4
Patches
-
Handle equal-length aliases for sub-commands: 6a08885
Previously, a subcommand only worked correctly if its alias had fewer segments:sade('git') .command('remote add <name> <url>') .alias('ra', 'remote new') // ... // BEFORE: Only `ra` worked // AFTER: Both `ra` and `remote new` work
- (perf) Faster command parsing: 6a08885
Fewerfor-loop
s to determine command alises.
Chores
- (CI) Move CI to GitHub Actions: 66c0912, a35149b
- (pkg): Ensure valid
author.url
format (#41): cf24e4f
Thank you @marvinhagemeister
v1.7.3
Patches
-
Prevent
prog.parse()
from mutating the input array (oftenprocess.argv
) (#36): 9d3fdcaWhile it's strongly recommended not to access
process.argv
directly with action handlers, Sade no longer manipulates its values. After all, why use a CLI framework that parses and formatsprocess.argv
for you if you're reaching past it for the same values?
v1.7.2
v1.7.1
Patches
-
Allows option flags to come before the command name: 4ccffe0
Important: As with any CLI program, these options must come in pairs!
Otherwise your command name may be interpreted as the flag's value.
This is not a new limitation.
Previously, Sade ignored all input flags that were defined before the command.$ doorman greet Luke --excited #=> ✓ hello Luke! $ doorman --excited greet Luke #=> ✘ Unknown command: Luke $ doorman --type Howdy greet Luke #=> ✓ Howdy Luke!
This was done so that Sade programs could be aliased/saved with common options.
For example, you may want to save something likeley
to a custom script:// package.json { "scripts": { "migrate": "ley -r dotenv/config" } }
As of this release, this is now possible! 🎉
Developers can successfully run this script like so:
yarn migrate up
Again, only as of this patch release, the-r dotenv/config
option will still be applied.
v1.7.0
v1.6.0
v1.5.1
v1.5.0
Features
-
Print custom or default error message when
opts.unknown
finds invalid flags: 922b7e4Example: Custom Output
// demo program sade('sirv') .command('start [dir]') .parse(process.argv, { unknown: arg => `Custom error message: ${arg}` });
# Pass invalid "--foobar" flag $ sirv start --foobar
ERROR Custom error message: --foobar Run `$ sirv --help` for more info.
Example: Default Output
// demo program sade('sirv') .command('start [dir]') .parse(process.argv, { // Pass function, but don't do anything // ~> means we just want validation unknown: () => false });
# Pass invalid "--foobar" flag $ sirv start --foobar
ERROR Parsed unknown option flag(s)! Run `$ sirv --help` for more info.