Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output diagnostics in cargo-style #797

Open
1 of 2 tasks
Emilgardis opened this issue Jun 14, 2022 · 6 comments
Open
1 of 2 tasks

Output diagnostics in cargo-style #797

Emilgardis opened this issue Jun 14, 2022 · 6 comments
Assignees

Comments

@Emilgardis
Copy link
Member

Checklist

Describe your request

cross should output it's warnings, notes and errors in the same way cargo does it

e.g something like this https://github.com/rust-lang/cargo/blob/ca4edabb28fc96fdf2a1d56fe3851831ac166f8a/src/cargo/core/shell.rs#L251-L257

Describe why this would be a good inclusion for cross

This will make integration with cargo look better

@Emilgardis
Copy link
Member Author

When doing this, we could also insert a [c] or something similar as a prefix to the output we make to make it clear what cross is doing

@Alexhuszagh
Copy link
Contributor

Alexhuszagh commented Jun 24, 2022

This should also have the verbosity settings: we should also parse quiet. This should also be passed to rustup.

@Alexhuszagh Alexhuszagh self-assigned this Jun 24, 2022
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 25, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 25, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 25, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 25, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 26, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 26, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 26, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
@Alexhuszagh Alexhuszagh modified the milestones: v0.3.0, v0.2.3 Jun 26, 2022
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 26, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 26, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 27, 2022
Adds the quiet and color command-line flags, where color supports
`auto`, always`, and `never`. These command-line flags are parsed to a
verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument,
and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help
ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which
formats the command and sends it to the shell. This allows us to avoid
using `print_verbose` where we sometimes manually override the default
setting.

Closes cross-rs#797.
bors bot added a commit that referenced this issue Jun 27, 2022
859: Add cargo-style output diagnostics. r=Emilgardis a=Alexhuszagh

Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

A few of these settings aren't currently used (such as `info` and `status`, but they're a very common pattern), so we can ensure we have the necessary utilities to ensure we can properly format messages in the future. A few like `shell::print` are practically identical to `println!`, but this allows us to customize it if need be in the future.

Solves parts of #797.

Co-authored-by: Alex Huszagh <[email protected]>
Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 27, 2022
Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

Closes cross-rs#797.
bors bot added a commit that referenced this issue Jun 27, 2022
859: Add cargo-style output diagnostics. r=Emilgardis a=Alexhuszagh

Adds the quiet and color command-line flags, where color supports `auto`, always`, and `never`. These command-line flags are parsed to a verbosity which can be quiet, normal, or verbose.

With these, we then have the stderr message formatters:
- `fatal_usage`: print a fatal error message with the failing argument, and add a help context menu for how to use cross.
- `fatal`: print red 'error' message and exit with an error code
- `error`: print red 'error' message
- `warn`: print amber 'warning' message
- `note`: print cyan 'note' message
- `status`: print an uncolored and unprefixed 'status' message

We have the stdout message formatters:
- `print`: always print the message
- `info`: print the message as long as the verbosity is not quiet
- `debug`: only print the message if the output is not quiet

We also have a few specialized error handlers, and methods to help ensure we can have flexible error reporting in the future:
- `status_stderr`
- `status_stdout`

The command extensions now have, `print`, `info`, and `debug`, which formats the command and sends it to the shell. This allows us to avoid using `print_verbose` where we sometimes manually override the default setting.

A few of these settings aren't currently used (such as `info` and `status`, but they're a very common pattern), so we can ensure we have the necessary utilities to ensure we can properly format messages in the future. A few like `shell::print` are practically identical to `println!`, but this allows us to customize it if need be in the future.

Solves parts of #797.

Co-authored-by: Alex Huszagh <[email protected]>
@bors bors bot closed this as completed in eef20f9 Jun 27, 2022
@Emilgardis
Copy link
Member Author

reopening as there still some action left, i.e info/note messages

@Emilgardis Emilgardis reopened this Jun 27, 2022
@Emilgardis Emilgardis removed this from the v0.2.3 milestone Jul 4, 2022
@Alexhuszagh
Copy link
Contributor

Is this closes now that we can erase lines via #911? We should have essentially full support of the functionality of cargo's diagnostics itself.

@Emilgardis
Copy link
Member Author

No, I'm thinking something like

$ cross build --target arm-unknown-linux-gnueabi
  Installing target arm-unknown-linux-gnueabi
      Docker running pre-build hooks
      Docker ...

@Emilgardis
Copy link
Member Author

Basically, instead of some wait time when there's some setup needed for cross, display some nice data so that one doesn't think it's stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants