This repository has been archived by the owner on Jan 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Cli ergonomics #9
Closed
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
64c1bc8
Travis updates
gibix 2ec7760
update copyright
gibix fac490a
Small code shake-up
gibix e7a61f8
Bump cargo version to 1.27
gibix d94ab48
Use structopt for argument parsing
gibix 58c7335
Better error handling with failure::Error
gibix 3596224
Handle --ebuild-path flag
gibix eb25067
Add basic logging with env_logger
gibix 0ef37ce
Drop cargo for cargo_metadata
gibix 96d7e97
Add first integration test
gibix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,5 @@ time = "^0.1" | |
structopt = "0.2.8" | ||
failure = "0.1.1" | ||
human-panic = "1.0.0" | ||
log = "0.4.0" | ||
env_logger = "0.5.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,11 @@ | |
extern crate human_panic; | ||
#[macro_use] | ||
extern crate structopt; | ||
extern crate env_logger; | ||
extern crate cargo_ebuild; | ||
extern crate log; | ||
|
||
use log::Level as LogLevel; | ||
use cargo_ebuild::*; | ||
use structopt::StructOpt; | ||
|
||
|
@@ -32,9 +35,23 @@ pub struct Cli { | |
} | ||
|
||
fn main() -> Result<(), Error> { | ||
setup_panic!(); | ||
|
||
let args = Cli::from_args(); | ||
|
||
setup_panic!(); | ||
env_logger::Builder::new() | ||
.filter( | ||
None, | ||
match args.verbosity { | ||
0 => LogLevel::Error, | ||
1 => LogLevel::Warn, | ||
2 => LogLevel::Info, | ||
3 => LogLevel::Debug, | ||
_ => LogLevel::Trace, | ||
}.to_level_filter(), | ||
) | ||
.try_init()?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have nothing using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all the warns in cargo_ebuild::build are log. Log will be used more in future. |
||
|
||
|
||
run_cargo_ebuild(args.cmd) | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if someone inputted the wrong arguments we're not going to show them the following:
This is the wrong crate for the job. Printing out a reasonable error message worked previously and this isn't reasonable.