Merge pull request #1007 from matthiasbeyer/bin-refactor

Remove safety check, error handling has that case already
This commit is contained in:
Matthias Beyer 2017-08-25 17:36:22 +02:00 committed by GitHub
commit ec1c1e8e3d

View file

@ -204,13 +204,6 @@ fn main() {
None => Vec::new() None => Vec::new()
}; };
// Typos happen, so check if the given subcommand is one found in $PATH
if !commands.contains(&String::from(subcommand)) {
println!("No such command: 'imag-{}'", subcommand);
println!("See 'imag --help' for available subcommands");
exit(2);
}
debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args); debug!("Calling 'imag-{}' with args: {:?}", subcommand, subcommand_args);
// Create a Command, and pass it the gathered arguments // Create a Command, and pass it the gathered arguments
@ -235,8 +228,6 @@ fn main() {
debug!("Error calling the subcommand"); debug!("Error calling the subcommand");
match e.kind() { match e.kind() {
ErrorKind::NotFound => { ErrorKind::NotFound => {
// With the check above, this absolutely should not happen.
// Keeping it to be safe
println!("No such command: 'imag-{}'", subcommand); println!("No such command: 'imag-{}'", subcommand);
println!("See 'imag --help' for available subcommands"); println!("See 'imag --help' for available subcommands");
exit(2); exit(2);