toolkit: Renames pretty-print-command (#10110)

It doesn't print, but returns a string.
So it should be called format.
This commit is contained in:
Hofer-Julian 2023-08-25 19:23:30 +02:00 committed by GitHub
parent ad12018199
commit 7ebdced256
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,7 @@ export def fmt [
--verbose: bool # print extra information about the command's progress --verbose: bool # print extra information about the command's progress
] { ] {
if $verbose { if $verbose {
print $"running ('toolkit fmt' | pretty-print-command)" print $"running ('toolkit fmt' | pretty-format-command)"
} }
if $check { if $check {
@ -20,7 +20,7 @@ export def fmt [
cargo fmt --all -- --check cargo fmt --all -- --check
} catch { } catch {
error make --unspanned { error make --unspanned {
msg: $"\nplease run ('toolkit fmt' | pretty-print-command) to fix formatting!" msg: $"\nplease run ('toolkit fmt' | pretty-format-command) to fix formatting!"
} }
} }
} else { } else {
@ -37,7 +37,7 @@ export def clippy [
--workspace: bool # run the *Clippy* command on the whole workspace (overrides `--features`) --workspace: bool # run the *Clippy* command on the whole workspace (overrides `--features`)
] { ] {
if $verbose { if $verbose {
print $"running ('toolkit clippy' | pretty-print-command)" print $"running ('toolkit clippy' | pretty-format-command)"
} }
try { try {
@ -56,7 +56,7 @@ export def clippy [
)} )}
} catch { } catch {
error make --unspanned { error make --unspanned {
msg: $"\nplease fix the above ('clippy' | pretty-print-command) errors before continuing!" msg: $"\nplease fix the above ('clippy' | pretty-format-command) errors before continuing!"
} }
} }
} }
@ -89,8 +89,8 @@ export def "test stdlib" [
cargo run -- -c $"use std testing; testing run-tests --path crates/nu-std ($extra_args)" cargo run -- -c $"use std testing; testing run-tests --path crates/nu-std ($extra_args)"
} }
# print the pipe input inside backticks, dimmed and italic, as a pretty command # formats the pipe input inside backticks, dimmed and italic, as a pretty command
def pretty-print-command [] { def pretty-format-command [] {
$"`(ansi default_dimmed)(ansi default_italic)($in)(ansi reset)`" $"`(ansi default_dimmed)(ansi default_italic)($in)(ansi reset)`"
} }
@ -243,7 +243,7 @@ export def "check pr" [
return (report --fail-clippy) return (report --fail-clippy)
} }
print $"running ('toolkit test' | pretty-print-command)" print $"running ('toolkit test' | pretty-format-command)"
try { try {
if $fast { if $fast {
test --features $features --fast test --features $features --fast
@ -254,7 +254,7 @@ export def "check pr" [
return (report --fail-test) return (report --fail-test)
} }
print $"running ('toolkit test stdlib' | pretty-print-command)" print $"running ('toolkit test stdlib' | pretty-format-command)"
try { try {
test stdlib test stdlib
} catch { } catch {
@ -270,10 +270,10 @@ export def "check pr" [
export def setup-git-hooks [] { export def setup-git-hooks [] {
print "This command will change your local git configuration and hence modify your development workflow. Are you sure you want to continue? [y]" print "This command will change your local git configuration and hence modify your development workflow. Are you sure you want to continue? [y]"
if (input) == "y" { if (input) == "y" {
print $"running ('toolkit setup-git-hooks' | pretty-print-command)" print $"running ('toolkit setup-git-hooks' | pretty-format-command)"
git config --local core.hooksPath .githooks git config --local core.hooksPath .githooks
} else { } else {
print $"aborting ('toolkit setup-git-hooks' | pretty-print-command)" print $"aborting ('toolkit setup-git-hooks' | pretty-format-command)"
} }
} }