Skip to content

Releases: lukeed/sade

v1.8.1

06 Jan 17:12
Compare
Choose a tag to compare

Patches

  • Fix 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: v1.8.0...v1.8.1

v1.8.0

31 Dec 18:28
Compare
Choose a tag to compare

Features

  • 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: v1.7.4...v1.8.0

v1.7.4

28 Sep 18:47
Compare
Choose a tag to compare

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
    Fewer for-loops to determine command alises.

Chores

v1.7.3

16 Feb 08:08
Compare
Choose a tag to compare

Patches

  • 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?

v1.7.2

13 Feb 04:45
Compare
Choose a tag to compare

Patches

  • Fixed regression from 1.7.1 which didn't parse opts.default commands' arguments correctly: 07645f8
    Also included tests to prevent future regressions.

v1.7.1

13 Feb 02:41
Compare
Choose a tag to compare

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 like ley 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

09 Dec 23:50
Compare
Choose a tag to compare

Features

v1.6.0

23 Jun 01:08
Compare
Choose a tag to compare

Features

Patches

  • Rename internal name key to bin instead (#24): 65483ff

v1.5.1

16 Jun 06:47
Compare
Choose a tag to compare

Patches

  • Render "Invalid command: {input}"error message for unknown command(s): c7c7b58
    This was always the intention, but regressed in 4b3a1de – oops

Chores

  • Add extensive integration/usage test suite: 885d9ad

v1.5.0

08 Jun 17:03
Compare
Choose a tag to compare

Features

  • 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.