Skip to content

cecton/cargo-firstpage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Version License LOC Dependency Status

cargo-firstpage

Show only the first page of rustc output.

Installation

cargo install cargo-firstpage

Usage

Add firstpage before any cargo command:

Examples

This runs cargo check but only shows the first page of output:

cargo firstpage check

This runs cargo run -p myproject:

cargo firstpage run -p myproject

All arguments after firstpage are passed directly to cargo without exception. cargo-firstpage does not have any option is and not parametrizable.

Using with cargo-watch

You can use it like this:

cargo watch -x "firstpage check"

If you want to see just the first page of the build output while keeping your program’s error messages:

cargo watch -x "firstpage build" -x "run"

For TUI (text user interface) programs, use this in one terminal:

CARGO_TERM_COLOR=always cargo watch \
    -x "firstpage build 2>/tmp/logs" \
    -x "run 2>>/tmp/logs"

And this in another terminal:

tail -F /tmp/logs

This setup keeps your program's stderr output scrolling while only showing the first page of build messages.

Troubleshooting

If your shell prompt takes up more than one line, cargo-firstpage might miscalculate how much space is available for output. To fix this, you can set the PROMPT_SIZE compilation parameter when installing the tool.

Example

If your prompt is 2 lines high:

PROMPT_SIZE=2 cargo install cargo-firstpage --force

Adjust the value of PROMPT_SIZE to match the number of lines your prompt uses.

Limitations

In most cases, the useful error messages appear at the end of the output. However, sometimes rustc shows important information at the beginning, like how to disable a warning.

Contributing

This project does not accept issues, pull requests, or other contributions. Forks are welcome — feel free to use, modify, and build on it as needed.

Related Tools

  • ograc: Shows diagnostic messages in reverse order, so important ones appear first. You can scroll up to see less important ones.
  • cargo-cut-diagnostics: Similar to cargo-firstpage, but keeps the progress bar and offers more options. The author claims it processes cargo output more accurately. Try this if you have issues with cargo-firstpage.
  • bacon: Combines features of cargo-watch with a small TUI that makes it easier to filter and read logs. Worth checking out if you want to improve the readability and scrolling of rustc output.

About

Shows only the first page of rustc output

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages