1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Fix typos (#982)

This commit is contained in:
Ian Manske 2024-11-21 20:51:05 -08:00 committed by GitHub
parent fc1d1989b6
commit dee0e7efcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 838 additions and 833 deletions

View file

@ -20,9 +20,9 @@ def "nu-complete adb wait-for-transport" [] {
def "nu-complete adb reboot-type" [] { def "nu-complete adb reboot-type" [] {
[ [
bootloader bootloader
recovery recovery
edl edl
sideload # Reboots into recovery and automatically starts sideload mode. sideload # Reboots into recovery and automatically starts sideload mode.
sideload-auto-reboot sideload-auto-reboot
" " " "
@ -38,7 +38,7 @@ export extern "adb" [
-H: string # name of adb server host [default=localhost] -H: string # name of adb server host [default=localhost]
-P: int # port of adb server [default=5037] -P: int # port of adb server [default=5037]
-L: string # listen on given socket for adb server [default=tcp:localhost:5037] -L: string # listen on given socket for adb server [default=tcp:localhost:5037]
--exit-on-write-error # exit if stdout is closed --exit-on-write-error # exit if stdout is closed
] ]
@ -55,7 +55,7 @@ export extern "adb connect" [
# Disconnect from given TCP/IP device [default PORT=5555], or all. # Disconnect from given TCP/IP device [default PORT=5555], or all.
export extern "adb disconnect" [ export extern "adb disconnect" [
host_port?: string # Disconnect device via TCP/IP [default PORT=5555] (disconnec all if no ip given). host_port?: string # Disconnect device via TCP/IP [default PORT=5555] (disconnect all if no ip given).
] ]
# Pair with a device for secure TCP/IP communication. # Pair with a device for secure TCP/IP communication.
@ -157,7 +157,7 @@ export extern "adb install-multi-package" [
# Remove specified application from the device # Remove specified application from the device
export extern "adb uninstall" [ export extern "adb uninstall" [
APPLICATION_ID: string # Remove this APPLICATION_ID from the device. APPLICATION_ID: string # Remove this APPLICATION_ID from the device.
-k -k
] ]
# Run remote shell command (interactive shell if no command given) # Run remote shell command (interactive shell if no command given)
@ -202,7 +202,7 @@ export extern "adb sync" [
] ]
# Ensure that there is a server running. # Ensure that there is a server running.
export extern "adb start-server" [ # only allowed with 'start-server' or 'server nodaemon', export extern "adb start-server" [ # only allowed with 'start-server' or 'server nodaemon',
--one-device: string@"nu-complete adb one-device-args" #server will only connect to one USB device, specified by a serial number or USB device address. --one-device: string@"nu-complete adb one-device-args" #server will only connect to one USB device, specified by a serial number or USB device address.
] ]
@ -281,7 +281,7 @@ export extern "adb remount" [
# Reboot the device; defaults to booting system image but supports bootloader and recovery too. # Reboot the device; defaults to booting system image but supports bootloader and recovery too.
export extern "adb reboot" [ export extern "adb reboot" [
type:string@"nu-complete adb reboot-type" type:string@"nu-complete adb reboot-type"
] ]
# Sideload the given full OTA package # Sideload the given full OTA package
@ -301,4 +301,4 @@ export extern "adb usb" []
# Restart adbd listening on TCP on PORT. # Restart adbd listening on TCP on PORT.
export extern "adb tcpip" [ export extern "adb tcpip" [
PORT:string PORT:string
] ]

View file

@ -13,7 +13,7 @@ This CLI can:
- create a new client action - create a new client action
- and rename an existing client action - and rename an existing client action
This `bmc` module particulary adds the completions for the [nushell](nushell.sh/) shell This `bmc` module particularly adds the completions for the [nushell](nushell.sh/) shell
## How to install ## How to install

View file

@ -17,7 +17,7 @@ export extern "bmc run" [
--version # Show version number --version # Show version number
] ]
# Import a new bussiness from a token # Import a new business from a token
export extern "bmc import" [ export extern "bmc import" [
apiToken: string # command apiToken: string # command
--help # Show help --help # Show help

View file

@ -9,8 +9,8 @@ def get-recipes [] {
def "nu-complete just" [] { def "nu-complete just" [] {
get-recipes get-recipes
| select recipe doc parameters | select recipe doc parameters
| each {|recipe| | each {|recipe|
let name = $recipe.recipe let name = $recipe.recipe
mut desc = $recipe.doc | default " " mut desc = $recipe.doc | default " "
for $p in $recipe.parameters { for $p in $recipe.parameters {
@ -33,7 +33,7 @@ def "nu-complete args" [context:string,offset:int] {
get-just-arg $name $position get-just-arg $name $position
} }
# Provides argument of recipe $name at position $positions. # Provides argument of recipe $name at position $positions.
def get-just-arg [name:string,position:int] { def get-just-arg [name:string,position:int] {
let recipes = ( let recipes = (
get-recipes get-recipes
@ -46,7 +46,7 @@ def get-just-arg [name:string,position:int] {
} else { } else {
$recipes $recipes
| get $position | get $position
| each {|recipe| | each {|recipe|
let name = $recipe.name let name = $recipe.name
if not ($recipe.default | is-empty) { if not ($recipe.default | is-empty) {
[[value description]; [[value description];
@ -63,7 +63,7 @@ def get-just-arg [name:string,position:int] {
} }
} }
# Veriables and Assignments are apparently the same thing... # Variables and Assignments are apparently the same thing...
def "nu-complete just assignments" [] { def "nu-complete just assignments" [] {
^just --dump --dump-format json ^just --dump --dump-format json
| from json | from json
@ -121,7 +121,7 @@ export extern "just" [
--shell-arg # Invoke shell with <SHELL-ARG> as an argument --shell-arg # Invoke shell with <SHELL-ARG> as an argument
--show(-s):string@"nu-complete just" # Show information about <RECIPE> --show(-s):string@"nu-complete just" # Show information about <RECIPE>
--working-directory(-d) # Use <WORKING-DIRECTORY> as working directory. --justfile must also be set --working-directory(-d) # Use <WORKING-DIRECTORY> as working directory. --justfile must also be set
] ]
def "nu-complete just format" [] { def "nu-complete just format" [] {
[ "just", "json" ] [ "just", "json" ]

View file

@ -38,9 +38,9 @@ def "nu-complete kw man pages" [] {
def "nu-complete kw warnings" [] { def "nu-complete kw warnings" [] {
[ [
[value description]; [value description];
["1" "not too often, may be relevant"] ["1" "not too often, may be relevant"]
["2" "quite often, may still be relevant"] ["2" "quite often, may still be relevant"]
["3" "more obscure, likely ignorable"] ["3" "more obscure, likely ignorable"]
["12" "warns 1 and 2"] ["12" "warns 1 and 2"]
["13" "warns 1 and 3"] ["13" "warns 1 and 3"]
@ -59,9 +59,9 @@ def "nu-complete kw init template" [] {
def "nu-complete kw init arch" [] { def "nu-complete kw init arch" [] {
if ("arch" | path exists) { if ("arch" | path exists) {
ls arch ls arch
| where type == "dir" | where type == "dir"
| get name | get name
| each {|el| $el | str replace 'arch/' ''} | each {|el| $el | str replace 'arch/' ''}
} else { } else {
[] []
@ -77,8 +77,8 @@ def "nu-complete kw cores" [] {
} }
def "nu-complete kw configs" [] { def "nu-complete kw configs" [] {
^kw config -s ^kw config -s
| lines | lines
| parse --regex '\[.*\] (?<value>[a-z_.]+)=(?<description>.+)$' | parse --regex '\[.*\] (?<value>[a-z_.]+)=(?<description>.+)$'
} }
@ -105,7 +105,7 @@ export extern "kw version" [
...args: string ...args: string
] ]
# Initalize kworkflow config file # Initialize kworkflow config file
export extern "kw init" [ export extern "kw init" [
--template: string@"nu-complete kw init template" # Uses a template as the kworkflow.config --template: string@"nu-complete kw init template" # Uses a template as the kworkflow.config
--arch: string@"nu-complete kw init arch" # Sets the variable arch from the newly created kworkflow.config --arch: string@"nu-complete kw init arch" # Sets the variable arch from the newly created kworkflow.config
@ -117,12 +117,12 @@ export extern "kw init" [
# Builds the kernel # Builds the kernel
export extern "kw build" [ export extern "kw build" [
...flags: string ...flags: string
--info(-i) # Displays build information --info(-i) # Displays build information
--menu(-n) # Invokes the kernel menuconfig --menu(-n) # Invokes the kernel menuconfig
--doc(-d) # Builds the documentation --doc(-d) # Builds the documentation
--cpu-scaling(-S): int@"nu-complete kw cores" # Sets the number of jobs to use for building the kernel (the -j flag) --cpu-scaling(-S): int@"nu-complete kw cores" # Sets the number of jobs to use for building the kernel (the -j flag)
--ccache # Enable ccache --ccache # Enable ccache
--warnings(-w): string@"nu-complete kw warnings" # Sets the warning level for the kernel build --warnings(-w): string@"nu-complete kw warnings" # Sets the warning level for the kernel build
--save-log-to(-s): string # Saves the build log to a file --save-log-to(-s): string # Saves the build log to a file
--llvm # Uses LLVM toolchain during compilation and linking --llvm # Uses LLVM toolchain during compilation and linking
@ -186,14 +186,14 @@ export alias "kw s" = kw ssh
export extern "kw codestyle" [ export extern "kw codestyle" [
path?: string # Which files to run checkpatch on. Defaults to the cwd path?: string # Which files to run checkpatch on. Defaults to the cwd
--help(-h) # Shows help page --help(-h) # Shows help page
--verbose # Verbose mode --verbose # Verbose mode
] ]
export alias "kw c" = kw codestyle export alias "kw c" = kw codestyle
export extern "kw self-update" [ export extern "kw self-update" [
--unstable(-u) # Update kw based on the unstable branch --unstable(-u) # Update kw based on the unstable branch
--help(-h) # Shows help page --help(-h) # Shows help page
--verbose # Verbose mode --verbose # Verbose mode
] ]
@ -212,9 +212,9 @@ export alias "kw m" = kw maintainers
export extern "kw kernel-config-manager" [ export extern "kw kernel-config-manager" [
--save: string # Creates a snapshot of the .config file with the given name --save: string # Creates a snapshot of the .config file with the given name
-d: string # Sets the description when using --save -d: string # Sets the description when using --save
--force(-f) # Supress warnings --force(-f) # Suppress warnings
--get: string # Gets the config with the given name and overwrites the current .config file --get: string # Gets the config with the given name and overwrites the current .config file
--remove(-r): string # Removes the config with the given name --remove(-r): string # Removes the config with the given name
--list(-l) # Lists all the configs being managed --list(-l) # Lists all the configs being managed
--fetch # Fetches a .config from a target machine --fetch # Fetches a .config from a target machine
--output(-o): string # Sets the output file when using --fetch --output(-o): string # Sets the output file when using --fetch
@ -256,7 +256,7 @@ export extern "kw explore" [
expr?: string # Expression to search for expr?: string # Expression to search for
--log(-l) # Search using git log with the given string --log(-l) # Search using git log with the given string
--grep(-g) # Search using grep with the given string --grep(-g) # Search using grep with the given string
--all(-a) # Search using git grep with the given string --all(-a) # Search using git grep with the given string
--only-source(-c) # Show only results from source code --only-source(-c) # Show only results from source code
--only-header(-H) # Show only results from header --only-header(-H) # Show only results from header
-p: string # Path to where to start the search -p: string # Path to where to start the search
@ -272,7 +272,7 @@ export extern "kw pomodoro" [
--tag(-g): string # Tag the pomodoro --tag(-g): string # Tag the pomodoro
--description(-d): string # Describe the pomodoro task --description(-d): string # Describe the pomodoro task
--check-timer(-c) # Check the current timer --check-timer(-c) # Check the current timer
--show-tags(-s) # Show all tags used in pomodoros --show-tags(-s) # Show all tags used in pomodoros
--help(-h) # Shows help page --help(-h) # Shows help page
--verbose # Verbose mode --verbose # Verbose mode
] ]
@ -284,7 +284,7 @@ export extern "kw report" [
--year: string="" # Shows the report for the current year if not specified <year> --year: string="" # Shows the report for the current year if not specified <year>
--month: string="" # Shows the report for the current month if not specified <year>/<month> --month: string="" # Shows the report for the current month if not specified <year>/<month>
--week: string="" # Shows the report for the current week if not specified <year>/<week> --week: string="" # Shows the report for the current week if not specified <year>/<week>
--day: string="" # Shows the report for the current day if not specified <year>/<month>/<day> --day: string="" # Shows the report for the current day if not specified <year>/<month>/<day>
--all # Shows all the data in the report --all # Shows all the data in the report
--statistics(-s) # Shows the statistics of the report --statistics(-s) # Shows the statistics of the report
--pomodoro # Shows the pomodoro data in the report --pomodoro # Shows the pomodoro data in the report
@ -304,7 +304,7 @@ export extern "kw device" [
] ]
# kernel debug # kernel debug
export extern "kw debug" [ export extern "kw debug" [
--dmesg(-g) # Collect dmesg log. --dmesg(-g) # Collect dmesg log.
--event(-e): string="" # Enable specific events to be traced. If no event is specified, all events will be enabled. --event(-e): string="" # Enable specific events to be traced. If no event is specified, all events will be enabled.
--ftrace(-t) # Enable ftrace. --ftrace(-t) # Enable ftrace.
@ -368,7 +368,7 @@ export extern "kw clear-cache" []
# drm subsystem support # drm subsystem support
export extern "kw drm" [ export extern "kw drm" [
--local # Show all DRM drivers available in the local machine. --local # Show all DRM drivers available in the local machine.
--remote: string # Specify the target device for the drm action, can be a remote or local machine. --remote: string # Specify the target device for the drm action, can be a remote or local machine.
--load-module: string # Allow user to specify one or more modules to load with or without parameters. --load-module: string # Allow user to specify one or more modules to load with or without parameters.
--unload-module: string # Allow users to unload one or more DRM drivers. --unload-module: string # Allow users to unload one or more DRM drivers.
@ -388,8 +388,8 @@ export extern "kw vm" [
--alert: string@"nu-complete kw deploy alert" # set alert behaviour upon command completion --alert: string@"nu-complete kw deploy alert" # set alert behaviour upon command completion
] ]
# Show kw man page # Show kw man page
export extern "kw help" [] export extern "kw help" []
export alias "kw h" = kw help export alias "kw h" = kw help

View file

@ -1,6 +1,6 @@
# authour: DWTW # authour: DWTW
def platformOveride [] { def platformOverride [] {
[ "linux", "macos", "windows", "sunos", "osx", "android" ] [ "linux", "macos", "windows", "sunos", "osx", "android" ]
} }
@ -13,7 +13,7 @@ export extern "tldr" [
string? string?
--list(-l) # Lists all commands in the cache --list(-l) # Lists all commands in the cache
--render(-f): string # Render a specific markdown file --render(-f): string # Render a specific markdown file
--platform(-f): string@platformOveride # Override the operating system --platform(-f): string@platformOverride # Override the operating system
--language(-L): string # Override the language --language(-L): string # Override the language
--update(-u) # Update the local cache --update(-u) # Update the local cache
--no-auto-update # If auto update is configured. disable it for this run --no-auto-update # If auto update is configured. disable it for this run

View file

@ -5,6 +5,7 @@ author_site: https://twitter.com/nu_shell
author_image: https://www.nushell.sh/blog/images/nu_logo.png author_image: https://www.nushell.sh/blog/images/nu_logo.png
excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds... excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
--- ---
<!-- TODO: complete the excerpt above --> <!-- TODO: complete the excerpt above -->
<!-- NOTE: start from the TODO all the way at the bottom (and sort of work your way up) --> <!-- NOTE: start from the TODO all the way at the bottom (and sort of work your way up) -->
@ -12,6 +13,7 @@ excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
# Nushell {{VERSION}} # Nushell {{VERSION}}
<!-- TODO: write this excerpt --> <!-- TODO: write this excerpt -->
Today, we're releasing version {{VERSION}} of Nu. This release adds... Today, we're releasing version {{VERSION}} of Nu. This release adds...
# Where to get it # Where to get it
@ -58,9 +60,9 @@ As part of this release, we also publish a set of optional plugins you can insta
Thanks to all the contributors below for helping us solve issues, improve documentation, refactor code, and more! :pray: Thanks to all the contributors below for helping us solve issues, improve documentation, refactor code, and more! :pray:
| author | title | link | | author | title | link |
| ------------------------------------ | ----------- | ------------------------------------------------------- | | ------------------------------------ | ----- | ------------------------------------------------------- |
| [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) | | [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) |
# Full changelog # Full changelog
@ -69,7 +71,7 @@ Thanks to all the contributors below for helping us solve issues, improve docume
- run `list-prs --milestone v{{VERSION}} | pr-table` - run `list-prs --milestone v{{VERSION}} | pr-table`
- paste the output here - paste the output here
Afterwards, go through each PR and clasify it as one of the following: Afterwards, go through each PR and classify it as one of the following:
- A user-facing change. These PRs should go into the `# Changes` section. - A user-facing change. These PRs should go into the `# Changes` section.
- A plugin-facing change. These PRs should go in `# Notes for plugin developers`. Some plugin-facing changes might also be a user-facing change and vice versa. - A plugin-facing change. These PRs should go in `# Notes for plugin developers`. Some plugin-facing changes might also be a user-facing change and vice versa.
- A documentation improvement, error message improvement, refactoring PR, clippy fix, typo fix, etc. These PRs go into the `# Hall of fame`. You can just copy the table row in this section and paste it to the `# Hall of fame` section above. Note that major refactorings may warrant a section in `# Highlights`. - A documentation improvement, error message improvement, refactoring PR, clippy fix, typo fix, etc. These PRs go into the `# Hall of fame`. You can just copy the table row in this section and paste it to the `# Hall of fame` section above. Note that major refactorings may warrant a section in `# Highlights`.

View file

@ -38,7 +38,7 @@ def print_colour [ colour:int ] {
$bg_color + $fg_color + $text + " " $bg_color + $fg_color + $text + " "
} }
let printable_colours = 256 const printable_colours = 256
def print_run [start:int, amount:int] { def print_run [start:int, amount:int] {
$start..<($start + $amount) | each { |i| $start..<($start + $amount) | each { |i|
@ -62,12 +62,13 @@ def print_blocks [start:int, end:int, block_cols:int, block_rows:int, blocks_per
} | str join } | str join
} }
print (print_run 0 16) # The first 16 colours are spread over the whole spectrum export def main [] {
print "" # Single line print (print_run 0 16) # The first 16 colours are spread over the whole spectrum
print (print_blocks 16 123 6 6 3) # 6x6x6 colour cube between 16 and 123 inclusive print "" # Single line
print (print_blocks 124 231 6 6 3) # 6x6x6 colour cube between 124 and 231 inclusive print (print_blocks 16 123 6 6 3) # 6x6x6 colour cube between 16 and 123 inclusive
print (print_blocks 232 255 12 2 1) # Not 50, but 24 Shades of Grey print (print_blocks 124 231 6 6 3) # 6x6x6 colour cube between 124 and 231 inclusive
print (print_blocks 232 255 12 2 1) # Not 50, but 24 Shades of Grey
}
# bash: # bash:
@ -113,7 +114,7 @@ print (print_blocks 232 255 12 2 1) # Not 50, but 24 Shades of Grey
# #
# # Uncomment the below for more precise luminance calculations # # Uncomment the below for more precise luminance calculations
# #
# # # Calculate percieved brightness # # # Calculate perceived brightness
# # # See https://www.w3.org/TR/AERT#color-contrast # # # See https://www.w3.org/TR/AERT#color-contrast
# # # and http://www.itu.int/rec/R-REC-BT.601 # # # and http://www.itu.int/rec/R-REC-BT.601
# # # Luminance is in range 0..5000 as each value is 0..5 # # # Luminance is in range 0..5000 as each value is 0..5

View file

@ -1,5 +1,5 @@
# this script uses foreground ansi index colors to print # this script uses foreground ansi index colors to print
# a table of 16 rows by 16 colums where each item is a # a table of 16 rows by 16 columns where each item is a
# different color # different color
def show_index_colors [] { def show_index_colors [] {
let prefix = "38;5;" let prefix = "38;5;"
@ -24,4 +24,6 @@ def one_liner [] {
} }
show_index_colors export def main [] {
show_index_colors
}

View file

@ -1,7 +1,7 @@
# A Terminal Wordle game. # A Terminal Wordle game.
# The code is based on https://gist.github.com/huytd/6a1a6a7b34a0d0abcac00b47e3d01513 ,but slightly personalized. # The code is based on https://gist.github.com/huytd/6a1a6a7b34a0d0abcac00b47e3d01513 ,but slightly personalized.
# a simple termninal Wordle game! # a simple terminal Wordle game!
export def main [ export def main [
--unlimited(-u) # Play the game in unlimited mode. --unlimited(-u) # Play the game in unlimited mode.
--max_count(-M) : int = 6 # Give yourself more chances than default --max_count(-M) : int = 6 # Give yourself more chances than default
@ -23,7 +23,7 @@ export def main [
if (((($words | where column1 =~ $guess) | length) >= 1) and ($guess | str length) == 5) { if (((($words | where column1 =~ $guess) | length) >= 1) and ($guess | str length) == 5) {
mut out = "" mut out = ""
mut checked = $word mut checked = $word
for i in ($guess | split chars) -n { for i in ($guess | split chars | enumerate) {
if ($i.item == ($word | str substring ($i.index)..($i.index + 1)) ) { if ($i.item == ($word | str substring ($i.index)..($i.index + 1)) ) {
$out += $"(ansi green_reverse)($i.item)(ansi reset)" $out += $"(ansi green_reverse)($i.item)(ansi reset)"
$avail = ($avail | str replace $i.item $"(ansi green_reverse)($i.item)(ansi white_reverse)") $avail = ($avail | str replace $i.item $"(ansi green_reverse)($i.item)(ansi white_reverse)")
@ -46,10 +46,10 @@ export def main [
} else { } else {
echo "please enter a valid [5 letter] word!" echo "please enter a valid [5 letter] word!"
$guess_count -= 1 $guess_count -= 1
} }
} else { } else {
echo $"(ansi yellow )You loose, the word was: (ansi red)($word)(ansi reset)" echo $"(ansi yellow )You loose, the word was: (ansi red)($word)(ansi reset)"
$end = true $end = true
} }
} }
} }

View file

@ -211,7 +211,7 @@ export def "cartesian product" [
def cartesian_product [] { def cartesian_product [] {
use std assert use std assert
# emptyness # emptiness
assert equal (cartesian product [] []) [] assert equal (cartesian product [] []) []
assert equal (cartesian product []) [] assert equal (cartesian product []) []
assert equal (cartesian product) [] assert equal (cartesian product) []

View file

@ -1,15 +1,15 @@
# Build a full-line prompt with widgets for: # Build a full-line prompt with widgets for:
# activated python virtual environment (from `overlay use <ve>/bin/activate.nu`) # activated python virtual environment (from `overlay use <ve>/bin/activate.nu`)
# current working directory # current working directory
# git status (branch, branch ahead/behind remote, files changed) # git status (branch, branch ahead/behind remote, files changed)
# current position in remembered working directories (`std dirs`, a.k.a. `shells`) # current position in remembered working directories (`std dirs`, a.k.a. `shells`)
# also, as a nu dev special, widget for active nu executable (flags `cargo run` vs "installed" and which branch built from). # also, as a nu dev special, widget for active nu executable (flags `cargo run` vs "installed" and which branch built from).
# #
# to use: # to use:
# 1. copy this file to `($nu.default-config-dir | path add 'scripts')` (Or someplace on your $env.NU_LIB_DIRS path, defined in env.nu) # 1. copy this file to `($nu.default-config-dir | path add 'scripts')` (Or someplace on your $env.NU_LIB_DIRS path, defined in env.nu)
# 2. cut `$env.PROMPT_COMMAND` and `PROMPT_OMMAND_RIGHT' from your env.nu. # 2. cut `$env.PROMPT_COMMAND` and `PROMPT_OMMAND_RIGHT' from your env.nu.
# These will depend on `use full-line`, which can not be done in env.nu. # These will depend on `use full-line`, which can not be done in env.nu.
# You can leave the `PROMPT-*INDICATOR*` statements in env.nu or # You can leave the `PROMPT-*INDICATOR*` statements in env.nu or
# consolidate all prompt stuff in config.nu. # consolidate all prompt stuff in config.nu.
# 3. Add new prompt setup stuff somewhere in config.nu: # 3. Add new prompt setup stuff somewhere in config.nu:
# ``` # ```
@ -18,7 +18,7 @@
# $env.PROMPT_COMMAND_RIGHT = "" # $env.PROMPT_COMMAND_RIGHT = ""
# ``` # ```
# #
# credit panache-git for the git status widget. # credit panache-git for the git status widget.
use std dirs use std dirs
use std assert use std assert
@ -40,14 +40,14 @@ export def main [
let mid_content = ($" (dir_string) ") let mid_content = ($" (dir_string) ")
let mid_content_len = ($mid_content | ansi strip | str length -g) let mid_content_len = ($mid_content | ansi strip | str length -g)
let dirs_segment = $" |(dirs show | each {|it| if $it.active {'V'} else {'.'}} | str join '')|" let dirs_segment = $" |(dirs | each {|it| if $it.active {'V'} else {'.'}} | str join '')|"
let right_content = ($"(repo-styled)($pad_char + $pad_char + $pad_char)($dirs_segment)") let right_content = ($"(repo-styled)($pad_char + $pad_char + $pad_char)($dirs_segment)")
let right_content_len = ($right_content | ansi strip | str length -g) let right_content_len = ($right_content | ansi strip | str length -g)
let term_width = ((term size) | get columns) let term_width = ((term size) | get columns)
let mid_padding = ($term_width - $left_content_len - $right_content_len) let mid_padding = ($term_width - $left_content_len - $right_content_len)
[(ansi reset), [(ansi reset),
$left_content, $left_content,
($mid_content | fill --character $pad_char --width $mid_padding --alignment center), ($mid_content | fill --character $pad_char --width $mid_padding --alignment center),
@ -58,7 +58,7 @@ export def main [
# build current exe widget # build current exe widget
def current_exe [] { def current_exe [] {
let content = ([ let content = ([
($nu.current-exe | path dirname | path basename | str replace "bin" ""), ($nu.current-exe | path dirname | path basename | str replace "bin" ""),
(version | get branch | str replace "main" ""), (version | get branch | str replace "main" ""),
] | str join " " | str trim) ] | str join " " | str trim)
@ -70,7 +70,7 @@ def current_exe [] {
} }
# build current working directory segment # build current working directory segment
## don't get sucked into the path syntax wars: simply color portions of path to flag priviliged vs normal user mode. ## don't get sucked into the path syntax wars: simply color portions of path to flag privileged vs normal user mode.
def dir_string [] { def dir_string [] {
let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold })
@ -78,7 +78,7 @@ def dir_string [] {
$"($path_color)($env.PWD)(ansi reset)" | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" $"($path_color)($env.PWD)(ansi reset)" | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)"
} }
# Following code cheerfully ~~stolen~~ adapted from: # Following code cheerfully ~~stolen~~ adapted from:
# https://github.com/nushell/nu_scripts/blob/ab0d3aaad015ca8ac2c2004d728cc8bac32cda1b/modules/prompt/panache-git.nu # https://github.com/nushell/nu_scripts/blob/ab0d3aaad015ca8ac2c2004d728cc8bac32cda1b/modules/prompt/panache-git.nu
# Get repository status as structured data # Get repository status as structured data

View file

@ -20,7 +20,7 @@ export def construct_prompt [] {
# get the terminal width # get the terminal width
let term_width = (term size).columns let term_width = (term size).columns
# get the curren time # get the current time
let current_time = (date now | format date '%I:%M:%S%.3f %p') let current_time = (date now | format date '%I:%M:%S%.3f %p')
# let's construct the left and right prompt # let's construct the left and right prompt
@ -33,7 +33,7 @@ export def construct_prompt [] {
# the right side of the prompt with ansi colors # the right side of the prompt with ansi colors
let right_colored = $"(ansi blue)($env.CMD_DURATION_MS)|(ansi dark_gray)($current_time)(ansi reset)" let right_colored = $"(ansi blue)($env.CMD_DURATION_MS)|(ansi dark_gray)($current_time)(ansi reset)"
# let's calcuate the length of the right prompt so we know how much to pad the left prompt # let's calculate the length of the right prompt so we know how much to pad the left prompt
let calculated_right_len = ($term_width - $left_len) let calculated_right_len = ($term_width - $left_len)
# finally, let's make the prompt # finally, let's make the prompt
let the_prompt = $"($left_colored)($right_colored | fill -a r -c ' ' -w $calculated_right_len)(char newline)($decorator) " let the_prompt = $"($left_colored)($right_colored | fill -a r -c ' ' -w $calculated_right_len)(char newline)($decorator) "

View file

@ -2,168 +2,168 @@
# modes # modes
# * 8bit # * 8bit
# * 24bit # * 24bit
let color_mode = "8bit" const color_mode = "8bit"
# setup separate characters # setup separate characters
let left_prompt_separator_diff_color = (char -u 'e0b0') const left_prompt_separator_diff_color = (char -u 'e0b0')
let left_prompt_separator_same_color = (char -u 'e0b1') const left_prompt_separator_same_color = (char -u 'e0b1')
let right_prompt_separator_diff_color = (char -u 'e0b2') const right_prompt_separator_diff_color = (char -u 'e0b2')
let right_prompt_separator_same_color = (char -u 'e0b3') const right_prompt_separator_same_color = (char -u 'e0b3')
# setup color variables for 24bit and 8bit # setup color variables for 24bit and 8bit
# prompt # prompt
let prompt_color_frame_and_connection_24 = (ansi -e { fg: "#6C6C6C" }) const prompt_color_frame_and_connection_24 = (ansi -e { fg: "#6C6C6C" })
let prompt_color_separator_same_color_24 = (ansi -e { fg: "#949494" }) const prompt_color_separator_same_color_24 = (ansi -e { fg: "#949494" })
let prompt_color_frame_and_connection_8 = $"(ansi idx_fg)242m" const prompt_color_frame_and_connection_8 = $"(ansi idx_fg)242m"
let prompt_color_separator_same_color_8 = $"(ansi idx_fg)246m" const prompt_color_separator_same_color_8 = $"(ansi idx_fg)246m"
let prompt_add_new_line_before = false const prompt_add_new_line_before = false
let prompt_color_frame_and_connection = "" const prompt_color_frame_and_connection = ""
let prompt_color_separator_same_color = "" const prompt_color_separator_same_color = ""
let left_separator_diff_color = "" const left_separator_diff_color = ""
let left_separator_same_color = "" const left_separator_same_color = ""
let left_items = [] const left_items = []
let left_prefix = "" const left_prefix = ""
let left_suffix = "" const left_suffix = ""
let right_separator_diff_color = "" const right_separator_diff_color = ""
let right_separator_same_color = "" const right_separator_same_color = ""
let right_items = [] const right_items = []
let right_prefix = "" const right_prefix = ""
let right_suffix = "" const right_suffix = ""
# cmd # cmd
let cmd_duration_bg_color_24 = (ansi -e { bg: "#C4A000" }) const cmd_duration_bg_color_24 = (ansi -e { bg: "#C4A000" })
let cmd_duration_color_24 = (ansi -e { fg: "#000000" }) const cmd_duration_color_24 = (ansi -e { fg: "#000000" })
let cmd_duration_bg_color_8 = $"(ansi idx_bg)178m" const cmd_duration_bg_color_8 = $"(ansi idx_bg)178m"
let cmd_duration_color_8 = $"(ansi idx_fg)16m" const cmd_duration_color_8 = $"(ansi idx_fg)16m"
let cmd_bg_color = "" const cmd_bg_color = ""
let cmd_color = "" const cmd_color = ""
let cmd_decimals = 2 const cmd_decimals = 2
let cmd_icon = "" const cmd_icon = ""
# git # git
let git_bg_color_24 = (ansi -e { bg: "#4E9A06" }) const git_bg_color_24 = (ansi -e { bg: "#4E9A06" })
let git_bg_color_unstable_24 = (ansi -e { bg: "#C4A000" }) const git_bg_color_unstable_24 = (ansi -e { bg: "#C4A000" })
let git_bg_color_urgent_24 = (ansi -e { bg: "#CC0000" }) const git_bg_color_urgent_24 = (ansi -e { bg: "#CC0000" })
let git_color_branch_24 = (ansi -e { fg: "#000000" }) const git_color_branch_24 = (ansi -e { fg: "#000000" })
let git_color_conflicted_24 = (ansi -e { fg: "#000000" }) const git_color_conflicted_24 = (ansi -e { fg: "#000000" })
let git_color_dirty_24 = (ansi -e { fg: "#000000" }) const git_color_dirty_24 = (ansi -e { fg: "#000000" })
let git_color_operation_24 = (ansi -e { fg: "#000000" }) const git_color_operation_24 = (ansi -e { fg: "#000000" })
let git_color_staged_24 = (ansi -e { fg: "#000000" }) const git_color_staged_24 = (ansi -e { fg: "#000000" })
let git_color_stash_24 = (ansi -e { fg: "#000000" }) const git_color_stash_24 = (ansi -e { fg: "#000000" })
let git_color_untracked_24 = (ansi -e { fg: "#000000" }) const git_color_untracked_24 = (ansi -e { fg: "#000000" })
let git_color_upstream_24 = (ansi -e { fg: "#000000" }) const git_color_upstream_24 = (ansi -e { fg: "#000000" })
let git_bg_color_8 = $"(ansi idx_bg)70m" const git_bg_color_8 = $"(ansi idx_bg)70m"
let git_bg_color_unstable_8 = $"(ansi idx_bg)178m" const git_bg_color_unstable_8 = $"(ansi idx_bg)178m"
let git_bg_color_urgent_8 = $"(ansi idx_bg)160m" const git_bg_color_urgent_8 = $"(ansi idx_bg)160m"
let git_color_branch_8 = $"(ansi idx_fg)16m" const git_color_branch_8 = $"(ansi idx_fg)16m"
let git_color_conflicted_8 = $"(ansi idx_fg)16m" const git_color_conflicted_8 = $"(ansi idx_fg)16m"
let git_color_dirty_8 = $"(ansi idx_fg)16m" const git_color_dirty_8 = $"(ansi idx_fg)16m"
let git_color_operation_8 = $"(ansi idx_fg)16m" const git_color_operation_8 = $"(ansi idx_fg)16m"
let git_color_staged_8 = $"(ansi idx_fg)16m" const git_color_staged_8 = $"(ansi idx_fg)16m"
let git_color_stash_8 = $"(ansi idx_fg)16m" const git_color_stash_8 = $"(ansi idx_fg)16m"
let git_color_untracked_8 = $"(ansi idx_fg)16m" const git_color_untracked_8 = $"(ansi idx_fg)16m"
let git_color_upstream_8 = $"(ansi idx_fg)16m" const git_color_upstream_8 = $"(ansi idx_fg)16m"
let git_bg_color = "" const git_bg_color = ""
let git_bg_color_unstable = "" const git_bg_color_unstable = ""
let git_bg_color_urgent = "" const git_bg_color_urgent = ""
let git_color_branch = "" const git_color_branch = ""
let git_color_conflicted = "" const git_color_conflicted = ""
let git_color_dirty = "" const git_color_dirty = ""
let git_color_operation = "" const git_color_operation = ""
let git_color_staged = "" const git_color_staged = ""
let git_color_stash = "" const git_color_stash = ""
let git_color_untracked = "" const git_color_untracked = ""
let git_color_upstream = "" const git_color_upstream = ""
# os # os
let os_bg_color_24 = (ansi -e { bg: "#CED7CF" }) const os_bg_color_24 = (ansi -e { bg: "#CED7CF" })
let os_color_24 = (ansi -e { fg: "#080808" }) const os_color_24 = (ansi -e { fg: "#080808" })
let os_bg_color_8 = $"(ansi idx_bg)188m" const os_bg_color_8 = $"(ansi idx_bg)188m"
let os_color_8 = $"(ansi idx_fg)232m" const os_color_8 = $"(ansi idx_fg)232m"
let os_bg_color = "" const os_bg_color = ""
let os_color = "" const os_color = ""
# pwd # pwd
let pwd_bg_color_24 = (ansi -e { bg: "#3465A4" }) const pwd_bg_color_24 = (ansi -e { bg: "#3465A4" })
let pwd_color_anchors_24 = (ansi -e { fg: "#E4E4E4" }) const pwd_color_anchors_24 = (ansi -e { fg: "#E4E4E4" })
let pwd_color_dirs_24 = (ansi -e { fg: "#E4E4E4" }) const pwd_color_dirs_24 = (ansi -e { fg: "#E4E4E4" })
let pwd_color_truncated_dirs_24 = (ansi -e { fg: "#BCBCBC" }) const pwd_color_truncated_dirs_24 = (ansi -e { fg: "#BCBCBC" })
let pwd_bg_color_8 = $"(ansi idx_bg)61m" const pwd_bg_color_8 = $"(ansi idx_bg)61m"
let pwd_color_anchors_8 = $"(ansi idx_fg)254m" const pwd_color_anchors_8 = $"(ansi idx_fg)254m"
let pwd_color_dirs_8 = $"(ansi idx_fg)254m" const pwd_color_dirs_8 = $"(ansi idx_fg)254m"
let pwd_color_truncated_dirs_8 = $"(ansi idx_fg)250m" const pwd_color_truncated_dirs_8 = $"(ansi idx_fg)250m"
let pwd_bg_color = "" const pwd_bg_color = ""
let pwd_color_anchors = "" const pwd_color_anchors = ""
let pwd_color_dirs = "" const pwd_color_dirs = ""
let pwd_color_truncated_dirs = "" const pwd_color_truncated_dirs = ""
let pwd_icon = "" const pwd_icon = ""
let pwd_icon_home = "" const pwd_icon_home = ""
let pwd_icon_unwritable = "" const pwd_icon_unwritable = ""
let pwd_markers = [] const pwd_markers = []
# rustc # rustc
let rustc_bg_color_24 = (ansi -e { bg: "#F74C00" }) const rustc_bg_color_24 = (ansi -e { bg: "#F74C00" })
let rustc_color_24 = (ansi -e { fg: "#000000" }) const rustc_color_24 = (ansi -e { fg: "#000000" })
let rustc_bg_color_8 = $"(ansi idx_bg)202m" const rustc_bg_color_8 = $"(ansi idx_bg)202m"
let rustc_color_8 = $"(ansi idx_fg)16m" const rustc_color_8 = $"(ansi idx_fg)16m"
let rustc_bg_color = "" const rustc_bg_color = ""
let rustc_color = "" const rustc_color = ""
let rustc_icon = "" const rustc_icon = ""
# status # status
let status_bg_color_24 = (ansi -e { bg: "#2E3436" }) const status_bg_color_24 = (ansi -e { bg: "#2E3436" })
let status_bg_color_failure_24 = (ansi -e { bg: "#CC0000" }) const status_bg_color_failure_24 = (ansi -e { bg: "#CC0000" })
let status_color_24 = (ansi -e { fg: "#4E9A06" }) const status_color_24 = (ansi -e { fg: "#4E9A06" })
let status_color_failure_24 = (ansi -e { fg: "#FFFF00" }) const status_color_failure_24 = (ansi -e { fg: "#FFFF00" })
let status_bg_color_8 = $"(ansi idx_bg)236m" const status_bg_color_8 = $"(ansi idx_bg)236m"
let status_bg_color_failure_8 = $"(ansi idx_bg)160m" const status_bg_color_failure_8 = $"(ansi idx_bg)160m"
let status_color_8 = $"(ansi idx_fg)70m" const status_color_8 = $"(ansi idx_fg)70m"
let status_color_failure_8 = $"(ansi idx_fg)226m" const status_color_failure_8 = $"(ansi idx_fg)226m"
let status_bg_color = "" const status_bg_color = ""
let status_bg_color_faiure = "" const status_bg_color_failure = ""
let status_color = "" const status_color = ""
let status_color_failure = "" const status_color_failure = ""
let status_icon = "" const status_icon = ""
let status_icon_failure = "" const status_icon_failure = ""
# time # time
let time_bg_color_24 = (ansi -e { bg: "#D3D7CF" }) const time_bg_color_24 = (ansi -e { bg: "#D3D7CF" })
let time_color_24 = (ansi -e { fg: "#000000" }) const time_color_24 = (ansi -e { fg: "#000000" })
let time_bg_color_8 = $"(ansi idx_bg)188m" const time_bg_color_8 = $"(ansi idx_bg)188m"
let time_color_8 = $"(ansi idx_fg)16m" const time_color_8 = $"(ansi idx_fg)16m"
let time_bg_color = "" const time_bg_color = ""
let time_color = "" const time_color = ""
let time_format = "" const time_format = ""
# indicator # indicator
let indicator_color_24 = (ansi -e { fg: "#3465a4" }) const indicator_color_24 = (ansi -e { fg: "#3465a4" })
let indicator_bg_color_24 = (ansi -e { bg: "#000000" }) const indicator_bg_color_24 = (ansi -e { bg: "#000000" })
let indicator_color_8 = $"(ansi idx_fg)61m" const indicator_color_8 = $"(ansi idx_fg)61m"
let indicator_bg_color_8 = $"(ansi idx_bg)16m" const indicator_bg_color_8 = $"(ansi idx_bg)16m"
# terminal background color # terminal background color
let terminal_color_24 = (ansi -e { fg: "#c7c7c7" }) const terminal_color_24 = (ansi -e { fg: "#c7c7c7" })
let terminal_color_8 = (ansi white) const terminal_color_8 = (ansi white)
let terminal_bg_color_24 = (ansi -e { bg: "#000000" }) const terminal_bg_color_24 = (ansi -e { bg: "#000000" })
let terminal_bg_color_8 = (ansi black) const terminal_bg_color_8 = (ansi black)
# cmd_duration_ms # cmd_duration_ms
let cmd_duration_ms_color_24 = (ansi -e { fg: "#606060" }) const cmd_duration_ms_color_24 = (ansi -e { fg: "#606060" })
let cmd_duration_ms_color_8 = $"(ansi idx_fg)244m" const cmd_duration_ms_color_8 = $"(ansi idx_fg)244m"
let cmd_duration_ms_bg_color_24 = (ansi -e { fg: "#000000" }) const cmd_duration_ms_bg_color_24 = (ansi -e { fg: "#000000" })
let cmd_duration_ms_bg_color_8 = (ansi black) const cmd_duration_ms_bg_color_8 = (ansi black)
let runtime_colors = [ const runtime_colors = [
{ name: prompt_color_frame_and_connection, '8bit': $prompt_color_frame_and_connection_8, '24bit': $prompt_color_frame_and_connection_24 }, { name: prompt_color_frame_and_connection, '8bit': $prompt_color_frame_and_connection_8, '24bit': $prompt_color_frame_and_connection_24 },
{ name: prompt_color_separator_same_color, '8bit': $prompt_color_separator_same_color_8, '24bit': $prompt_color_separator_same_color_24 }, { name: prompt_color_separator_same_color, '8bit': $prompt_color_separator_same_color_8, '24bit': $prompt_color_separator_same_color_24 },
{ name: left_separator_diff_color, '8bit': $left_prompt_separator_diff_color, '24bit': $left_prompt_separator_diff_color }, { name: left_separator_diff_color, '8bit': $left_prompt_separator_diff_color, '24bit': $left_prompt_separator_diff_color },

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
# round an integer amount of nanoseconds to 4th digit and convert to a real duration # round an integer amount of nanoseconds to 4th digit and convert to a real duration
def "from ns" [] { def "from ns" [] {
if $in == 0 {0} else { #math log errors on 0 if $in == 0 {0} else { #math log errors on 0
math round -p (3 - ($in | math log 10 | math floor)) # rounds to 4th digit including, with maximum realtive err 0.05% math round -p (3 - ($in | math log 10 | math floor)) # rounds to 4th digit including, with maximum relative err 0.05%
| math round # second math round as a fix for `> 123456 | math round -p -5` = 99999.99999999999 | math round # second math round as a fix for `> 123456 | math round -p -5` = 99999.99999999999
} }
| into duration | into duration

View file

@ -19,7 +19,7 @@
# } # }
# ``` # ```
# #
# it's possible to write a much stronger script whith `parse-arg` # it's possible to write a much stronger script with `parse-arg`
# ```nushell # ```nushell
# def main [ # def main [
# x: string, # list<int> # x: string, # list<int>

View file

@ -1,13 +1,13 @@
use ./col-indices.nu * use ./col-indices.nu *
# Relect a range of columns by their indices # Reject a range of columns by their indices
# #
# Example: # Example:
# #
# ls | reject column-ranges 0 4 5 | first 3 # ls | reject column-ranges 0 4 5 | first 3
export def "reject column-ranges" [ export def "reject column-ranges" [
...ranges ...ranges
] { ] {
let column_selector = ($in | col-indices ...$ranges) let column_selector = ($in | col-indices ...$ranges)
$in | reject ...$column_selector $in | reject ...$column_selector
} }

View file

@ -13,7 +13,7 @@ use ./row-indices.nu *
# ls / | select 5 # ls / | select 5
# #
# Example - Select the 4th row. # Example - Select the 4th row.
# Note that the difference beteen this # Note that the difference between this
# and `select 3` is that the index (#) # and `select 3` is that the index (#)
# column shows the *original* (pre-select) # column shows the *original* (pre-select)
# position in the table. # position in the table.