From bea7ec33c1d0a7d64e50e42d00a941a2f84408c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Audiger?= <31616285+jaudiger@users.noreply.github.com> Date: Mon, 6 Feb 2023 13:43:00 +0100 Subject: [PATCH] Update few examples of math commands (#7987) # Description I just updated a few examples linked to math commands. I used the character of pi where possible, and I updated one example since the example was misleading IMO (for the tau command). # User-Facing Changes Only examples have been updated, there is no real user changes. # Tests + Formatting Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass # After Submitting If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. --- crates/nu-command/src/math/cos.rs | 2 +- crates/nu-command/src/math/tan.rs | 2 +- crates/nu-command/src/math/tanh.rs | 2 +- crates/nu-command/src/math/tau.rs | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/nu-command/src/math/cos.rs b/crates/nu-command/src/math/cos.rs index 80606c76ae..95a97ea8c3 100644 --- a/crates/nu-command/src/math/cos.rs +++ b/crates/nu-command/src/math/cos.rs @@ -48,7 +48,7 @@ impl Command for SubCommand { fn examples(&self) -> Vec { vec![ Example { - description: "Apply the cosine to pi", + description: "Apply the cosine to π", example: "math pi | math cos", result: Some(Value::test_float(-1f64)), }, diff --git a/crates/nu-command/src/math/tan.rs b/crates/nu-command/src/math/tan.rs index c03956a625..b756ce574e 100644 --- a/crates/nu-command/src/math/tan.rs +++ b/crates/nu-command/src/math/tan.rs @@ -48,7 +48,7 @@ impl Command for SubCommand { fn examples(&self) -> Vec { vec![ Example { - description: "Apply the tangent to pi/4", + description: "Apply the tangent to π/4", example: "(math pi) / 4 | math tan", result: Some(Value::test_float(1f64)), }, diff --git a/crates/nu-command/src/math/tanh.rs b/crates/nu-command/src/math/tanh.rs index 679e1d1fda..89d4352a7f 100644 --- a/crates/nu-command/src/math/tanh.rs +++ b/crates/nu-command/src/math/tanh.rs @@ -45,7 +45,7 @@ impl Command for SubCommand { fn examples(&self) -> Vec { vec![Example { - description: "Apply the hyperbolic tangent to 10*pi", + description: "Apply the hyperbolic tangent to 10*π", example: "(math pi) * 10 | math tanh", result: Some(Value::test_float(1f64)), }] diff --git a/crates/nu-command/src/math/tau.rs b/crates/nu-command/src/math/tau.rs index efbd93071a..d18e8458e4 100644 --- a/crates/nu-command/src/math/tau.rs +++ b/crates/nu-command/src/math/tau.rs @@ -29,9 +29,9 @@ impl Command for SubCommand { #[allow(clippy::approx_constant)] fn examples(&self) -> Vec { vec![Example { - example: "(math tau) / 2", - description: "Compare π and τ", - result: Some(Value::test_float(std::f64::consts::PI)), + example: "math tau | math round --precision 2", + description: "Get the first two decimal digits of τ", + result: Some(Value::test_float(6.28)), }] }