huak icon indicating copy to clipboard operation
huak copied to clipboard

Printing to stdout

Open cnpryer opened this issue 1 year ago • 6 comments

Currently most of huak operations print to stderr. An example of a command that should probably print to stdout would be huak version.

cnpryer avatar Jul 16 '23 22:07 cnpryer

I'd be willing to try helping, but I see on line 116 of huak_python.../src/sys.rs that this is intentional.

/// NOTE: Messages are printed to stderr. This is behavior cargo implements as well to
    /// avoid polluting stdout for end users. See <https://github.com/rust-lang/cargo/issues/1473>.
    fn print(
        &mut self,
        status: &dyn Display,
        message: Option<&dyn Display>,
        color: Color,
        justified: bool,
    ) -> HuakResult<()> {
        match self.options.verbosity {
            Verbosity::Quiet => Ok(()),
            _ => self
                .output
                .message_stderr(status, message, color, justified),
        }
    }

I hope someone will let me know if this is something I could potentially help change. Thank you in advance!

ethanbarry avatar Oct 09 '23 02:10 ethanbarry

Hi! huak version would make sense in stdout. I'm sure there are others, but that's definitely one. The idea is that huak version is often the type of command to be used to capture versions of projects.

cnpryer avatar Oct 09 '23 03:10 cnpryer

Awesome! I'll see what I can do this week. Thank you!

ethanbarry avatar Oct 09 '23 12:10 ethanbarry

Hey just a heads up I'm planning to refactor quite a bit in order to make some of the stuff I want to work on easier to do. So it might be better to hold off until that refactor work is done.

cnpryer avatar Oct 11 '23 22:10 cnpryer

Great, will do. I noticed a lot changed when I debased my local copy today...

ethanbarry avatar Oct 11 '23 22:10 ethanbarry

I'll be working on #718. There's more to refactor, but I probably won't refactor until I've implemented that. I'm treating it as a separate binary for now, then I'll refactor shared components out after it's done.

cnpryer avatar Oct 14 '23 00:10 cnpryer