5 ms·
I would love to see an option for showing the error order forward or backward. My workflow is to start fixing compile time errors from the top of the `cargo` ou
by waynenilsen 10y ago
I would love to see an option for showing the error order forward or backward. My workflow is to start fixing compile time errors from the top of the `cargo` output but scrolling to the top can be fairly annoying when there are a lot of errors. Having the most relevant error at the bottom of the command line (where it automatically scrolls) would be useful as an option IMO. This probably causes some other unseen problems however
- steveklabnik 10y agohttps://github.com/rust-lang/rust/issues/32650 https://github.com/rust-lang/rust/issues/32650
- ansible 10y agoWell, I just use 'more' or 'less' to see the beginning of the output. I'm also using GNU screen, and can easily scroll back through the terminal's history if I can't be bothered to re-run the command with a pager on the output.
- saghm 10y agoI sometimes do that, but the output loses the color it had, which can make parsing it a bit tricky (although the less noisy new format will help a bit with that)
- tbirdz 10y agoUse less -R to preserve color escape sequences when paging in less.
- heinrich5991 10y agoThis only helps if the program that pipes into less doesn't do terminal detection to decide that it doesn't want to output ANSI color escapes into a pipe (to less).
- abbeyj 10y agoYou may sometimes be able to work around this by using `expect` which creates a pseudoterminal attached to the program's stdout instead of a pipe. For example, say the program you want to run is `ls --color=auto`. This produces color when stdout is a terminal but no color when stdout is a pipe. If we just did: ls --color=auto | less -R we'd see no color. Instead we can run ls under expect: expect -c "spawn -noecho ls --color=auto; expect" | less -R and color abounds. There may be an easier way to accomplish this. If anybody has ideas, chime in.
- saghm 10y agoThis partially works for me with "cargo test"; it also seems to print a control character ('^O') after every colored string, as well as at very beginning of the output. Additionally, after a certain amount of output (maybe 1.5 times my terminal height), it prints an ellipsis and stops printing anything new. Thanks a bunch for pointing me towards `expect`, though! I hadn't used it before, and I'll definitely do some experimenting with it to see if I can get my desired output with it.
- bennofs 10y agocargo build --color always | less -R should work with recent cargo, alternativly `cargo rustc --color always -- --color always 2>&1 | less -R` works as well.
- saghm 10y agoThanks, I never knew this trick! This is working for me with "cargo build", but not "cargo test" unfortunately
- klodolph 10y agoI find it's much easier to use editor integration to do this, rather than opening a separate terminal window to compile.
- 0xffff2 10y agoDo you use Windows? I haven't found an editor with decent Rust integration on Windows yet.