kite-sdk / kite

Kite SDK
http://kitesdk.org/docs/current/
Apache License 2.0
394 stars 263 forks source link

Kite-1046: Add num-records option to json-schema command #398

Closed mladkov closed 9 years ago

mladkov commented 9 years ago

This code piggy backs on the existing strategy for parsing new options.

Only difference here is adding the "arity" parameter, to force users to enter exactly 1 value.

Here's how the help text now looks:

Usage: ./kite-dataset [general options] json-schema <sample json path> [command options]

  Description:

    Build a schema from a JSON data sample

  Command options:

    -n, --num-records
    Number of records to derive schema from (default: 10)
    -o, --output
    Save schema avsc to path
  * --class, --record-name
    A name or class for the result schema
    --minimize
    Minimize schema file size by eliminating white space

  * = required

If you don't enter a value in, you'll see this:

Expected a value after parameter --num-records

And if you specify something other than a valid integer is gives you this:

"-n": couldn't convert "blah" to an integer
mladkov commented 9 years ago

Ryan, what happens next? Will these changes be pulled or rejected? When will the pull actually happen if approved?

rdblue commented 9 years ago

Merged as https://github.com/kite-sdk/kite/commit/ff6afe42. Thanks @mladkov!