Skip to content

v1.5.0

Compare
Choose a tag to compare
@lukeed lukeed released this 08 Jun 17:03
· 31 commits to master since this release

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.