scullionw / dirstat-rs

(fastest?) disk usage cli, similar to windirstat.
MIT License
157 stars 11 forks source link

Display any error returned by main in a nicer way #2

Open nickwanninger opened 3 years ago

nickwanninger commented 3 years ago

Previously, returning an error from main prints out the rust representation of the error struct: image

This PR moves the existing main into it's own function so the real main can handle errors nicely: image

Mart-Bogdan commented 2 years ago

I mean other code is having this check:

    let color_choice = if atty::is(Stream::Stdout) {
        ColorChoice::Auto
    } else {
        ColorChoice::Never
    };
    let stdout = BufferWriter::stdout(color_choice);