Commands can now call a simple function (execute_main) with some type
params, and get flags and stdin converted into their expected structs
automatically. Commands that return a json-serializable struct will also
get that struct automatically serialized into the output.
Additionally, error handling is now handled in a central location. If a
command returns a CargoError, its message will be printed (soon in
color!) and its exit code will be used to exit the process.
Started to extract some of the generic behavior across all commands into
`execute_main` so that the commands themselves just need to operate
against structs (for JSON in and Flags)
At the same time, we started adding a generic error handling concept to
Cargo.
The idea is that every Result gets converted to a CargoError, which
includes all the information that Cargo needs to print out a friendly
human error message and exit gracefully.
At the same time, we started adding a generic error handling concept to
Cargo.
The idea is that every Result gets converted to a CargoError, which
includes all the information that Cargo needs to print out a friendly
human error message and exit gracefully.
At the moment, only the bare bones command is working with some defaults
hardcoded. Also, there is a bunch of necessary cleanup and no tests.
However, this marks the first end-to-end functionality in Cargo!