-
Notifications
You must be signed in to change notification settings - Fork 17
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
feat: Added the ability to use the TEACH-ME mode #221
Conversation
@FroVolod Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: waiting for scoringWe're waiting for maintainer to score this pull request with What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
Screen.Recording.2024-11-10.at.23.06.23.mov |
cargo-near/src/main.rs
Outdated
if env::var("RUST_LOG").is_ok() { | ||
let environment = if std::env::var(env_keys::nep330::BUILD_ENVIRONMENT).is_ok() { | ||
"container".cyan() | ||
} else { | ||
"host".purple() | ||
}; | ||
let my_formatter = | ||
cargo_near::types::my_formatter::MyFormatter::from_environment(environment); | ||
|
||
let env_filter = EnvFilter::from_default_env(); | ||
let format = format::debug_fn(move |writer, _field, value| write!(writer, "{:?}", value)); | ||
|
||
tracing_subscriber::registry() | ||
.with( | ||
tracing_subscriber::fmt::layer() | ||
.event_format(my_formatter) | ||
.fmt_fields(format) | ||
.with_filter(env_filter), | ||
) | ||
.init(); | ||
tracing_subscriber::registry() | ||
.with( | ||
tracing_subscriber::fmt::layer() | ||
.event_format(my_formatter) | ||
.fmt_fields(format) | ||
.with_filter(EnvFilter::from_default_env()), | ||
) | ||
.init(); | ||
} else if cli_cmd.teach_me || cli_near_args.teach_me { | ||
let env_filter = EnvFilter::from_default_env() | ||
.add_directive(tracing::Level::WARN.into()) | ||
.add_directive("near_teach_me=info".parse()?) | ||
.add_directive("near_cli_rs=info".parse()?) | ||
.add_directive("tracing_instrument=info".parse()?); | ||
tracing_subscriber::registry() | ||
.with( | ||
tracing_subscriber::fmt::layer() | ||
.without_time() | ||
.with_target(false), | ||
) | ||
.with(env_filter) | ||
.init(); | ||
} else { | ||
let indicatif_layer = IndicatifLayer::new() | ||
.with_progress_style( | ||
ProgressStyle::with_template( | ||
"{spinner:.blue}{span_child_prefix} {span_name} {msg} {span_fields}", | ||
) | ||
.unwrap() | ||
.tick_strings(&[ | ||
"▹▹▹▹▹", | ||
"▸▹▹▹▹", | ||
"▹▸▹▹▹", | ||
"▹▹▸▹▹", | ||
"▹▹▹▸▹", | ||
"▹▹▹▹▸", | ||
"▪▪▪▪▪", | ||
]), | ||
) | ||
.with_span_child_prefix_symbol("↳ "); | ||
let env_filter = EnvFilter::from_default_env() | ||
.add_directive(tracing::Level::WARN.into()) | ||
.add_directive("near_cli_rs=info".parse()?) | ||
.add_directive("tracing_instrument=info".parse()?); | ||
tracing_subscriber::registry() | ||
.with( | ||
tracing_subscriber::fmt::layer() | ||
.without_time() | ||
.with_writer(indicatif_layer.get_stderr_writer()), | ||
) | ||
.with(indicatif_layer) | ||
.with(env_filter) | ||
.init(); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i strongly suggest
- making these blocks a function with following signature
pub fn setup_tracing(rust_log_env_is_set: bool, teach_me_flag_is_set: bool) {
....
}
- putting it and related
tracing-*
imports intocargo-near/src/lib.rs
- then this function https://github.com/near/cargo-near/blob/main/integration-tests/src/lib.rs#L11-L32 can be replaced with
pub fn setup_tracing() {
cargo_near::setup_tracing(true, false);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
skip_all | ||
)] | ||
fn execute_git_commands(project_dir: &std::path::Path) -> near_cli_rs::CliResult { | ||
tracing::Span::current().pb_set_message("`git` commands ..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one doesn't get displayed on --teach-me
, but we probably can figure this out in subsequent prs
@race-of-sloths score 13 |
@FroVolod Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 13! @dj8yfo received 25 Sloth Points for reviewing and scoring this pull request. Another weekly streak completed, well done @FroVolod! To keep your weekly streak and get another bonus make pull request next week! Looking forward to see you in race-of-sloths What is the Race of SlothsRace of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow For contributors:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
## 🤖 New release * `cargo-near`: 0.11.0 -> 0.12.0 (⚠️ API breaking changes) * `cargo-near-build`: 0.3.0 -> 0.3.1 (✓ API compatible changes) ###⚠️ `cargo-near` breaking changes ``` --- failure constructible_struct_adds_field: externally-constructible struct adds field --- Description: A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field. ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/constructible_struct_adds_field.ron Failed in: field CliNearArgs.teach_me in /tmp/.tmp06Ielo/cargo-near/cargo-near/src/lib.rs:30 field InteractiveClapContextScopeForNearArgs.teach_me in /tmp/.tmp06Ielo/cargo-near/cargo-near/src/lib.rs:30 --- failure constructible_struct_adds_private_field: struct no longer constructible due to new private field --- Description: A struct constructible with a struct literal has a new non-public field. It can no longer be constructed using a struct literal outside of its crate. ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.36.0/src/lints/constructible_struct_adds_private_field.ron Failed in: field NearArgs.teach_me in /tmp/.tmp06Ielo/cargo-near/cargo-near/src/lib.rs:35 ``` <details><summary><i><b>Changelog</b></i></summary><p> ## `cargo-near` <blockquote> ## [0.12.0](cargo-near-v0.11.0...cargo-near-v0.12.0) - 2024-11-14 ### Added - Added the ability to use the TEACH-ME mode ([#221](#221)) ### Other - Gracefully handle missing `git` on `cargo near new` ([#246](#246)) - update `cargo near new` template `image` and `image_digest` ([#244](#244)) </blockquote> ## `cargo-near-build` <blockquote> ## [0.3.1](cargo-near-build-v0.3.0...cargo-near-build-v0.3.1) - 2024-11-14 ### Added - Added the ability to use the TEACH-ME mode ([#221](#221)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/MarcoIeni/release-plz/).
Screen.Recording.2024-10-04.at.08.16.08.mov