Refactor CLI organisation, and improve termination #570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As part of what we discussed in #555 we want to improve the CLI of
run
to be better, as part of that to make code for the commands more easily maintainable, I've first gone ahead and done a small refactor that moves each command into its own file and implementing them as their own types with a method to run them. This improves locality by a lot as now everything related to one command exists entirely in that one file.The only actual changes in this PR are the following.
src/main.rs
we now catch the result ourselves and ensure to emit it as atracing::error
, using theDisplay
formatting before exiting with a non-zero error code. Previously it would use theDebug
formatting and output tostdout
.Cli
type from the library that can be used to drive the application, as opposed to exposingrun
andmanage
as free functions.