10 Commits

Author SHA1 Message Date
Alec Thomas a32b94b705 chore: interface{} -> any 2024-12-29 08:10:34 +09:00
Alec Thomas 6408010083 Clean up disparity between Context and Kong.
Previously, there was a confusing mix of functionality shared between
the two wherein you would need to use the Kong type for printing errors,
etc. but it did not have access to the context in order to print
context-sensitive usage information. This has been fixed.

Additionally, there are now fuzzy correction suggestions for flags and
commands

Also added a server example which shows how Kong can be used for parsing
in interactive shells. Run with:

    $ go run ./_examples/server/*.go

Then interact with:

    $ ssh -p 6740 127.0.0.1
2018-06-27 09:11:11 +10:00
Alec Thomas a2ec050947 Implement a robust Context.Run().
This helps when composing large applications from separate command
structs.
2018-06-21 21:50:30 +10:00
Alec Thomas 232faad0a0 Add configuration loading + docs + linter fixes. 2018-06-13 10:34:19 +10:00
Alec Thomas 891f8623c1 Make kong.Parse() global more useful. 2018-06-05 21:31:38 +10:00
Gerald Kaszuba ecd369e622 Kong tag PR fixes (#12)
* Removed bubbling errors in favour of panic
* Added a test for Parse with a bad build and an arg.
* Removed is() function in favour of a switch with strings
* Collect key and value in parseCSV, reducing complexity.
* Fix in global to not use parser instance on error.
2018-05-22 09:18:08 -04:00
Gerald Kaszuba 3eb5e285ed Use "kong" as tag keys fixes #9 (#10) 2018-05-21 09:25:19 -04:00
Alec Thomas d03571a873 Use variadic options to configure Kong. 2018-05-18 21:17:48 +10:00
Alec Thomas 1d00dfef7b Implemented most of the base parser.
This includes branching arguments as well as commands, eg.

    app user create <id> <first> <last>
    app user <id> delete
    app user <id> rename <to>

Of note, required/optional flags and positional arguments are not
currently enforced.
2018-05-16 20:33:18 +10:00
Alec Thomas aa1bf9dcb5 Initial commit. 2018-04-10 16:51:06 +10:00