NewYour coding agent can read the release notes before it upgrades.Set up the MCP server β
npm
npm, #3150 most downloaded on npm
Smooth (CLI) operator πΆ
Latest stable
1.8.1
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 2 weeks to 1.3 years
Most releases are documented
notes for 19 of 23 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
23 releases Β· first in 2017
Drag across the ruler to compare, or tap a release to open it.
Fix sade.Handler type; which is no longer a generic (#52): f75579a _This change allows for a seamless upgrade from the @types/sade package._
sade.Handler type; which is no longer a generic (#52): f75579a
This change allows for a seamless upgrade from the @types/sade package.Full Changelog: https://github.com/lukeed/sade/compare/v1.8.0...v1.8.1
Add initial Deno support (#48): 5ebb94c _Available via `deno.land/x/sade`_ _Thank you @ryanccn~!_
Add initial Deno support (#48): 5ebb94c
Available via deno.land/x/sade
Thank you @ryanccn~!
Add "module" for bundler-friendly ESM (#51): cb05689
Builds lib/* 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 your action() 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: https://github.com/lukeed/sade/compare/v1.7.4...v1.8.0
Your coding agent can read these notes before it upgrades. Set up the MCP server β
Handle equal-length aliases for sub-commands: 6a08885 _Previously, a subcommand only worked correctly if its alias had fewer segments:_
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
for-loops to determine command alises.author.url format (#41): cf24e4f
Thank you @marvinhagemeisterPrevent prog.parse() from mutating the input array (often process.argv) (#36): 9d3fdca
Prevent prog.parse() from mutating the input array (often process.argv) (#36): 9d3fdca
While 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 formats process.argv for you if you're reaching past it for the same values?
Fixed regression from 1.7.1 which didn't parse opts.default commands' arguments correctly: 07645f8 _Also included tests to prevent future regressions.
1.7.1 which didn't parse opts.default commands' arguments correctly: 07645f8
Also included tests to prevent future regressions.Allows option flags to come _before_ the command name: 4ccffe0
Allows option flags to come before the command name: 4ccffe0
Important: As with any CLI program, these options must come in pairs!<br>Otherwise your command name may be interpreted as the flag's value.<br><br>This is not a new limitation.<br>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.<br>For example, you may want to save something like ley to a custom script:
// package.json
{
"scripts": {
"migrate": "ley -r dotenv/config"
}
}
As of this release, this is now possible! :tada:
Developers can successfully run this script like so: yarn migrate up<br>Again, only as of this patch release, the -r dotenv/config option will still be applied.
Add support for "command aliases" (#26, #34): fb1edcc _Read Command Aliases for docs and examples_
Nothing published for this version
Add support for "single-command mode" (#2, #25): 00d355b _Read Single Command Mode for docs and example_
name key to bin instead (#24): 65483ffRender "Invalid command: {input}"error message for unknown command(s): c7c7b58 _This was always the intention, but regressed in https://github.com/luk
"Invalid command: {input}"error message for unknown command(s): c7c7b58
This was always the intention, but regressed in https://github.com/lukeed/sade/commit/4b3a1def46eccef7f0a3ef9fda6dea809a7e68ae β oopsPrint custom or default error message when opts.unknown finds invalid flags: 922b7e4
Print custom or default error message when opts.unknown finds invalid flags: 922b7e4
Example: 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.
Prevent runtime error when opts.unknown is defined: 8f0b44a
opts.unknown is defined: 8f0b44aReplaced pad-right dependency with native String.repeat method. _Did not make sense to include 2 deps for a single, non-perf-critical utility function
pad-right dependency with native String.repeat method.
Did not make sense to include 2 deps for a single, non-perf-critical utility function.Fixed an issue where multiple optional arguments were assigned incorrect values: 8904ddb _Silly mistake; was using pop() instead of shift(), oops._ π
Fixed an issue where multiple optional arguments were assigned incorrect values: 8904ddb
Silly mistake; was using pop() instead of shift(), oops. π
Added tests to lock in the fix & prevent regressions: 9641aac
NEW: Added lazy option to parse() method, deferring handler execution: 4556ff2, 762aab8
lazy option to parse() method, deferring handler execution: 4556ff2, 762aab8--help output: d552429utils.help tests: 6edd1f7FIX: Allow flag names to contain hyphens (#9, #10): 6796849, c764aa2
FIX: Allow flag names to contain hyphens (#9, #10): 6796849, c764aa2
Thanks to @mrwest808 for jumping on this! π
Added util.parse tests: ccb9269, 991558d
Added util.sentences tests: 98079db
Updated README for hyphenated flag change: a133c1f, 54ceebc
Fixes offset pointer after assuming/implying the default command: b787be1
Fixes offset pointer after assuming/implying the default command: b787be1
Thanks to @developit for catching this & sending a fix, too! π
Adds support for git-like subcommands! :tada: : 4b3a1de, 33437b5
Adds support for git-like subcommands! :tada: : 4b3a1de, 33437b5
const prog = sade('git');
// Not necessary for subcommands to work, but it's here anyway!
prog
.command('remote')
.describe('Manage set of tracked repositories')
.action(opts => {
console.log('~> Print current remotes...');
});
prog
.command('remote add <name> <url>', 'Demo...')
.action((name, url, opts) => {
console.log(`~> Adding a new remote (${name}) to ${url}`);
});
prog
.command('remote rename <old> <new>', 'Demo...')
.action((old, nxt, opts) => {
console.log(`~> Renaming from ${old} to ${nxt}~!`);
});
Display error & exit if arguments are unmet (#4): 9f0f053
<required> arguments are unmet (#4): 9f0f053[optional] arguments thru to the aciton() handler (#5): 228eb7c
undefined to parameter if no value<required> args be defined before <optional> argsopts) as the last parameterNothing published for this version
No longer sets 1st command definition as the _default command_: da418cd, 8fe618a
prog.parse() arity; adds opts param: e51a7c4, 0d61d48default command if nothing else
3. Allow help & version output to run if still barren
4. Error & exit if still no command object, before execERROR output via utils.error: cab109cNothing published for this version
Nothing published for this version
One column per quarter.