mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-07-30 13:47:46 +00:00
Fix typos (#982)
This commit is contained in:
parent
fc1d1989b6
commit
dee0e7efcd
19 changed files with 838 additions and 833 deletions
|
@ -20,9 +20,9 @@ def "nu-complete adb wait-for-transport" [] {
|
|||
|
||||
def "nu-complete adb reboot-type" [] {
|
||||
[
|
||||
bootloader
|
||||
recovery
|
||||
edl
|
||||
bootloader
|
||||
recovery
|
||||
edl
|
||||
sideload # Reboots into recovery and automatically starts sideload mode.
|
||||
sideload-auto-reboot
|
||||
" "
|
||||
|
@ -38,7 +38,7 @@ export extern "adb" [
|
|||
-H: string # name of adb server host [default=localhost]
|
||||
-P: int # port of adb server [default=5037]
|
||||
-L: string # listen on given socket for adb server [default=tcp:localhost:5037]
|
||||
|
||||
|
||||
--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.
|
||||
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.
|
||||
|
@ -157,7 +157,7 @@ export extern "adb install-multi-package" [
|
|||
# Remove specified application from the device
|
||||
export extern "adb uninstall" [
|
||||
APPLICATION_ID: string # Remove this APPLICATION_ID from the device.
|
||||
-k
|
||||
-k
|
||||
]
|
||||
|
||||
# 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.
|
||||
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.
|
||||
]
|
||||
|
||||
|
@ -281,7 +281,7 @@ export extern "adb remount" [
|
|||
|
||||
# Reboot the device; defaults to booting system image but supports bootloader and recovery too.
|
||||
export extern "adb reboot" [
|
||||
type:string@"nu-complete adb reboot-type"
|
||||
type:string@"nu-complete adb reboot-type"
|
||||
]
|
||||
|
||||
# Sideload the given full OTA package
|
||||
|
@ -301,4 +301,4 @@ export extern "adb usb" []
|
|||
# Restart adbd listening on TCP on PORT.
|
||||
export extern "adb tcpip" [
|
||||
PORT:string
|
||||
]
|
||||
]
|
||||
|
|
|
@ -13,7 +13,7 @@ This CLI can:
|
|||
- create a new 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
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ export extern "bmc run" [
|
|||
--version # Show version number
|
||||
]
|
||||
|
||||
# Import a new bussiness from a token
|
||||
# Import a new business from a token
|
||||
export extern "bmc import" [
|
||||
apiToken: string # command
|
||||
--help # Show help
|
||||
|
|
|
@ -9,8 +9,8 @@ def get-recipes [] {
|
|||
|
||||
def "nu-complete just" [] {
|
||||
get-recipes
|
||||
| select recipe doc parameters
|
||||
| each {|recipe|
|
||||
| select recipe doc parameters
|
||||
| each {|recipe|
|
||||
let name = $recipe.recipe
|
||||
mut desc = $recipe.doc | default " "
|
||||
for $p in $recipe.parameters {
|
||||
|
@ -33,7 +33,7 @@ def "nu-complete args" [context:string,offset:int] {
|
|||
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] {
|
||||
let recipes = (
|
||||
get-recipes
|
||||
|
@ -46,7 +46,7 @@ def get-just-arg [name:string,position:int] {
|
|||
} else {
|
||||
$recipes
|
||||
| get $position
|
||||
| each {|recipe|
|
||||
| each {|recipe|
|
||||
let name = $recipe.name
|
||||
if not ($recipe.default | is-empty) {
|
||||
[[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" [] {
|
||||
^just --dump --dump-format json
|
||||
| from json
|
||||
|
@ -121,7 +121,7 @@ export extern "just" [
|
|||
--shell-arg # Invoke shell with <SHELL-ARG> as an argument
|
||||
--show(-s):string@"nu-complete just" # Show information about <RECIPE>
|
||||
--working-directory(-d) # Use <WORKING-DIRECTORY> as working directory. --justfile must also be set
|
||||
]
|
||||
]
|
||||
|
||||
def "nu-complete just format" [] {
|
||||
[ "just", "json" ]
|
||||
|
|
|
@ -38,9 +38,9 @@ def "nu-complete kw man pages" [] {
|
|||
|
||||
def "nu-complete kw warnings" [] {
|
||||
[
|
||||
[value description];
|
||||
["1" "not too often, may be relevant"]
|
||||
["2" "quite often, may still be relevant"]
|
||||
[value description];
|
||||
["1" "not too often, may be relevant"]
|
||||
["2" "quite often, may still be relevant"]
|
||||
["3" "more obscure, likely ignorable"]
|
||||
["12" "warns 1 and 2"]
|
||||
["13" "warns 1 and 3"]
|
||||
|
@ -59,9 +59,9 @@ def "nu-complete kw init template" [] {
|
|||
|
||||
def "nu-complete kw init arch" [] {
|
||||
if ("arch" | path exists) {
|
||||
ls arch
|
||||
| where type == "dir"
|
||||
| get name
|
||||
ls arch
|
||||
| where type == "dir"
|
||||
| get name
|
||||
| each {|el| $el | str replace 'arch/' ''}
|
||||
} else {
|
||||
[]
|
||||
|
@ -77,8 +77,8 @@ def "nu-complete kw cores" [] {
|
|||
}
|
||||
|
||||
def "nu-complete kw configs" [] {
|
||||
^kw config -s
|
||||
| lines
|
||||
^kw config -s
|
||||
| lines
|
||||
| parse --regex '\[.*\] (?<value>[a-z_.]+)=(?<description>.+)$'
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ export extern "kw version" [
|
|||
...args: string
|
||||
]
|
||||
|
||||
# Initalize kworkflow config file
|
||||
# Initialize kworkflow config file
|
||||
export extern "kw init" [
|
||||
--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
|
||||
|
@ -117,12 +117,12 @@ export extern "kw init" [
|
|||
|
||||
# Builds the kernel
|
||||
export extern "kw build" [
|
||||
...flags: string
|
||||
...flags: string
|
||||
--info(-i) # Displays build information
|
||||
--menu(-n) # Invokes the kernel menuconfig
|
||||
--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)
|
||||
--ccache # Enable ccache
|
||||
--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
|
||||
--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
|
||||
--llvm # Uses LLVM toolchain during compilation and linking
|
||||
|
@ -186,14 +186,14 @@ export alias "kw s" = kw ssh
|
|||
export extern "kw codestyle" [
|
||||
path?: string # Which files to run checkpatch on. Defaults to the cwd
|
||||
--help(-h) # Shows help page
|
||||
--verbose # Verbose mode
|
||||
--verbose # Verbose mode
|
||||
]
|
||||
|
||||
export alias "kw c" = kw codestyle
|
||||
|
||||
export extern "kw self-update" [
|
||||
--unstable(-u) # Update kw based on the unstable branch
|
||||
--help(-h) # Shows help page
|
||||
--help(-h) # Shows help page
|
||||
--verbose # Verbose mode
|
||||
]
|
||||
|
||||
|
@ -212,9 +212,9 @@ export alias "kw m" = kw maintainers
|
|||
export extern "kw kernel-config-manager" [
|
||||
--save: string # Creates a snapshot of the .config file with the given name
|
||||
-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
|
||||
--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
|
||||
--fetch # Fetches a .config from a target machine
|
||||
--output(-o): string # Sets the output file when using --fetch
|
||||
|
@ -256,7 +256,7 @@ export extern "kw explore" [
|
|||
expr?: string # Expression to search for
|
||||
--log(-l) # Search using git log 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-header(-H) # Show only results from header
|
||||
-p: string # Path to where to start the search
|
||||
|
@ -272,7 +272,7 @@ export extern "kw pomodoro" [
|
|||
--tag(-g): string # Tag the pomodoro
|
||||
--description(-d): string # Describe the pomodoro task
|
||||
--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
|
||||
--verbose # Verbose mode
|
||||
]
|
||||
|
@ -284,7 +284,7 @@ export extern "kw report" [
|
|||
--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>
|
||||
--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
|
||||
--statistics(-s) # Shows the statistics of the report
|
||||
--pomodoro # Shows the pomodoro data in the report
|
||||
|
@ -304,7 +304,7 @@ export extern "kw device" [
|
|||
]
|
||||
|
||||
# kernel debug
|
||||
export extern "kw debug" [
|
||||
export extern "kw debug" [
|
||||
--dmesg(-g) # Collect dmesg log.
|
||||
--event(-e): string="" # Enable specific events to be traced. If no event is specified, all events will be enabled.
|
||||
--ftrace(-t) # Enable ftrace.
|
||||
|
@ -368,7 +368,7 @@ export extern "kw clear-cache" []
|
|||
|
||||
# drm subsystem support
|
||||
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.
|
||||
--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.
|
||||
|
@ -388,8 +388,8 @@ export extern "kw vm" [
|
|||
--alert: string@"nu-complete kw deploy alert" # set alert behaviour upon command completion
|
||||
]
|
||||
|
||||
|
||||
|
||||
# Show kw man page
|
||||
export extern "kw help" []
|
||||
|
||||
export alias "kw h" = kw help
|
||||
export alias "kw h" = kw help
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# authour: DWTW
|
||||
|
||||
def platformOveride [] {
|
||||
def platformOverride [] {
|
||||
[ "linux", "macos", "windows", "sunos", "osx", "android" ]
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ export extern "tldr" [
|
|||
string?
|
||||
--list(-l) # Lists all commands in the cache
|
||||
--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
|
||||
--update(-u) # Update the local cache
|
||||
--no-auto-update # If auto update is configured. disable it for this run
|
||||
|
|
|
@ -5,6 +5,7 @@ author_site: https://twitter.com/nu_shell
|
|||
author_image: https://www.nushell.sh/blog/images/nu_logo.png
|
||||
excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
---
|
||||
|
||||
<!-- TODO: complete the excerpt above -->
|
||||
|
||||
<!-- 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}}
|
||||
|
||||
<!-- TODO: write this excerpt -->
|
||||
|
||||
Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
|
||||
# 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:
|
||||
|
||||
| author | title | link |
|
||||
| ------------------------------------ | ----------- | ------------------------------------------------------- |
|
||||
| [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) |
|
||||
| author | title | link |
|
||||
| ------------------------------------ | ----- | ------------------------------------------------------- |
|
||||
| [@author](https://github.com/author) | ... | [#12345](https://github.com/nushell/nushell/pull/12345) |
|
||||
|
||||
# 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`
|
||||
- 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 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`.
|
||||
|
|
|
@ -38,7 +38,7 @@ def print_colour [ colour:int ] {
|
|||
$bg_color + $fg_color + $text + " "
|
||||
}
|
||||
|
||||
let printable_colours = 256
|
||||
const printable_colours = 256
|
||||
|
||||
def print_run [start:int, amount:int] {
|
||||
$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
|
||||
}
|
||||
|
||||
print (print_run 0 16) # The first 16 colours are spread over the whole spectrum
|
||||
print "" # Single line
|
||||
print (print_blocks 16 123 6 6 3) # 6x6x6 colour cube between 16 and 123 inclusive
|
||||
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
|
||||
|
||||
export def main [] {
|
||||
print (print_run 0 16) # The first 16 colours are spread over the whole spectrum
|
||||
print "" # Single line
|
||||
print (print_blocks 16 123 6 6 3) # 6x6x6 colour cube between 16 and 123 inclusive
|
||||
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:
|
||||
|
||||
|
@ -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
|
||||
#
|
||||
# # # Calculate percieved brightness
|
||||
# # # Calculate perceived brightness
|
||||
# # # See https://www.w3.org/TR/AERT#color-contrast
|
||||
# # # and http://www.itu.int/rec/R-REC-BT.601
|
||||
# # # Luminance is in range 0..5000 as each value is 0..5
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# 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
|
||||
def show_index_colors [] {
|
||||
let prefix = "38;5;"
|
||||
|
@ -24,4 +24,6 @@ def one_liner [] {
|
|||
}
|
||||
|
||||
|
||||
show_index_colors
|
||||
export def main [] {
|
||||
show_index_colors
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
# a simple termninal Wordle game!
|
||||
# a simple terminal Wordle game!
|
||||
export def main [
|
||||
--unlimited(-u) # Play the game in unlimited mode.
|
||||
--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) {
|
||||
mut out = ""
|
||||
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)) ) {
|
||||
$out += $"(ansi green_reverse)($i.item)(ansi reset)"
|
||||
$avail = ($avail | str replace $i.item $"(ansi green_reverse)($i.item)(ansi white_reverse)")
|
||||
|
@ -46,10 +46,10 @@ export def main [
|
|||
} else {
|
||||
echo "please enter a valid [5 letter] word!"
|
||||
$guess_count -= 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo $"(ansi yellow )You loose, the word was: (ansi red)($word)(ansi reset)"
|
||||
$end = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ export def "cartesian product" [
|
|||
def cartesian_product [] {
|
||||
use std assert
|
||||
|
||||
# emptyness
|
||||
# emptiness
|
||||
assert equal (cartesian product [] []) []
|
||||
assert equal (cartesian product []) []
|
||||
assert equal (cartesian product) []
|
||||
|
|
|
@ -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`)
|
||||
# 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`)
|
||||
# also, as a nu dev special, widget for active nu executable (flags `cargo run` vs "installed" and which branch built from).
|
||||
#
|
||||
#
|
||||
# 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)
|
||||
# 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.
|
||||
# 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.
|
||||
# 3. Add new prompt setup stuff somewhere in config.nu:
|
||||
# ```
|
||||
|
@ -18,7 +18,7 @@
|
|||
# $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 assert
|
||||
|
@ -40,14 +40,14 @@ export def main [
|
|||
|
||||
let mid_content = ($" (dir_string) ")
|
||||
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_len = ($right_content | ansi strip | str length -g)
|
||||
|
||||
let term_width = ((term size) | get columns)
|
||||
let mid_padding = ($term_width - $left_content_len - $right_content_len)
|
||||
|
||||
|
||||
[(ansi reset),
|
||||
$left_content,
|
||||
($mid_content | fill --character $pad_char --width $mid_padding --alignment center),
|
||||
|
@ -58,7 +58,7 @@ export def main [
|
|||
|
||||
# build current exe widget
|
||||
def current_exe [] {
|
||||
let content = ([
|
||||
let content = ([
|
||||
($nu.current-exe | path dirname | path basename | str replace "bin" ""),
|
||||
(version | get branch | str replace "main" ""),
|
||||
] | str join " " | str trim)
|
||||
|
@ -70,7 +70,7 @@ def current_exe [] {
|
|||
}
|
||||
|
||||
# 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 [] {
|
||||
|
||||
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)"
|
||||
}
|
||||
|
||||
# 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
|
||||
|
||||
# Get repository status as structured data
|
||||
|
|
|
@ -20,7 +20,7 @@ export def construct_prompt [] {
|
|||
# get the terminal width
|
||||
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's construct the left and right prompt
|
||||
|
@ -33,7 +33,7 @@ export def construct_prompt [] {
|
|||
# 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'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)
|
||||
# finally, let's make the prompt
|
||||
let the_prompt = $"($left_colored)($right_colored | fill -a r -c ' ' -w $calculated_right_len)(char newline)($decorator) "
|
||||
|
|
|
@ -2,168 +2,168 @@
|
|||
# modes
|
||||
# * 8bit
|
||||
# * 24bit
|
||||
let color_mode = "8bit"
|
||||
const color_mode = "8bit"
|
||||
|
||||
# setup separate characters
|
||||
let left_prompt_separator_diff_color = (char -u 'e0b0')
|
||||
let left_prompt_separator_same_color = (char -u 'e0b1')
|
||||
let right_prompt_separator_diff_color = (char -u 'e0b2')
|
||||
let right_prompt_separator_same_color = (char -u 'e0b3')
|
||||
const left_prompt_separator_diff_color = (char -u 'e0b0')
|
||||
const left_prompt_separator_same_color = (char -u 'e0b1')
|
||||
const right_prompt_separator_diff_color = (char -u 'e0b2')
|
||||
const right_prompt_separator_same_color = (char -u 'e0b3')
|
||||
|
||||
# setup color variables for 24bit and 8bit
|
||||
# prompt
|
||||
let prompt_color_frame_and_connection_24 = (ansi -e { fg: "#6C6C6C" })
|
||||
let prompt_color_separator_same_color_24 = (ansi -e { fg: "#949494" })
|
||||
let prompt_color_frame_and_connection_8 = $"(ansi idx_fg)242m"
|
||||
let prompt_color_separator_same_color_8 = $"(ansi idx_fg)246m"
|
||||
let prompt_add_new_line_before = false
|
||||
let prompt_color_frame_and_connection = ""
|
||||
let prompt_color_separator_same_color = ""
|
||||
const prompt_color_frame_and_connection_24 = (ansi -e { fg: "#6C6C6C" })
|
||||
const prompt_color_separator_same_color_24 = (ansi -e { fg: "#949494" })
|
||||
const prompt_color_frame_and_connection_8 = $"(ansi idx_fg)242m"
|
||||
const prompt_color_separator_same_color_8 = $"(ansi idx_fg)246m"
|
||||
const prompt_add_new_line_before = false
|
||||
const prompt_color_frame_and_connection = ""
|
||||
const prompt_color_separator_same_color = ""
|
||||
|
||||
let left_separator_diff_color = ""
|
||||
let left_separator_same_color = ""
|
||||
let left_items = []
|
||||
let left_prefix = ""
|
||||
let left_suffix = ""
|
||||
const left_separator_diff_color = ""
|
||||
const left_separator_same_color = ""
|
||||
const left_items = []
|
||||
const left_prefix = ""
|
||||
const left_suffix = ""
|
||||
|
||||
let right_separator_diff_color = ""
|
||||
let right_separator_same_color = ""
|
||||
let right_items = []
|
||||
let right_prefix = ""
|
||||
let right_suffix = ""
|
||||
const right_separator_diff_color = ""
|
||||
const right_separator_same_color = ""
|
||||
const right_items = []
|
||||
const right_prefix = ""
|
||||
const right_suffix = ""
|
||||
|
||||
# cmd
|
||||
let cmd_duration_bg_color_24 = (ansi -e { bg: "#C4A000" })
|
||||
let cmd_duration_color_24 = (ansi -e { fg: "#000000" })
|
||||
let cmd_duration_bg_color_8 = $"(ansi idx_bg)178m"
|
||||
let cmd_duration_color_8 = $"(ansi idx_fg)16m"
|
||||
let cmd_bg_color = ""
|
||||
let cmd_color = ""
|
||||
let cmd_decimals = 2
|
||||
let cmd_icon = ""
|
||||
const cmd_duration_bg_color_24 = (ansi -e { bg: "#C4A000" })
|
||||
const cmd_duration_color_24 = (ansi -e { fg: "#000000" })
|
||||
const cmd_duration_bg_color_8 = $"(ansi idx_bg)178m"
|
||||
const cmd_duration_color_8 = $"(ansi idx_fg)16m"
|
||||
const cmd_bg_color = ""
|
||||
const cmd_color = ""
|
||||
const cmd_decimals = 2
|
||||
const cmd_icon = ""
|
||||
|
||||
# git
|
||||
let git_bg_color_24 = (ansi -e { bg: "#4E9A06" })
|
||||
let git_bg_color_unstable_24 = (ansi -e { bg: "#C4A000" })
|
||||
let git_bg_color_urgent_24 = (ansi -e { bg: "#CC0000" })
|
||||
let git_color_branch_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_conflicted_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_dirty_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_operation_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_staged_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_stash_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_untracked_24 = (ansi -e { fg: "#000000" })
|
||||
let git_color_upstream_24 = (ansi -e { fg: "#000000" })
|
||||
const git_bg_color_24 = (ansi -e { bg: "#4E9A06" })
|
||||
const git_bg_color_unstable_24 = (ansi -e { bg: "#C4A000" })
|
||||
const git_bg_color_urgent_24 = (ansi -e { bg: "#CC0000" })
|
||||
const git_color_branch_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_conflicted_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_dirty_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_operation_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_staged_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_stash_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_untracked_24 = (ansi -e { fg: "#000000" })
|
||||
const git_color_upstream_24 = (ansi -e { fg: "#000000" })
|
||||
|
||||
let git_bg_color_8 = $"(ansi idx_bg)70m"
|
||||
let git_bg_color_unstable_8 = $"(ansi idx_bg)178m"
|
||||
let git_bg_color_urgent_8 = $"(ansi idx_bg)160m"
|
||||
let git_color_branch_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_conflicted_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_dirty_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_operation_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_staged_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_stash_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_untracked_8 = $"(ansi idx_fg)16m"
|
||||
let git_color_upstream_8 = $"(ansi idx_fg)16m"
|
||||
const git_bg_color_8 = $"(ansi idx_bg)70m"
|
||||
const git_bg_color_unstable_8 = $"(ansi idx_bg)178m"
|
||||
const git_bg_color_urgent_8 = $"(ansi idx_bg)160m"
|
||||
const git_color_branch_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_conflicted_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_dirty_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_operation_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_staged_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_stash_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_untracked_8 = $"(ansi idx_fg)16m"
|
||||
const git_color_upstream_8 = $"(ansi idx_fg)16m"
|
||||
|
||||
let git_bg_color = ""
|
||||
let git_bg_color_unstable = ""
|
||||
let git_bg_color_urgent = ""
|
||||
let git_color_branch = ""
|
||||
let git_color_conflicted = ""
|
||||
let git_color_dirty = ""
|
||||
let git_color_operation = ""
|
||||
let git_color_staged = ""
|
||||
let git_color_stash = ""
|
||||
let git_color_untracked = ""
|
||||
let git_color_upstream = ""
|
||||
const git_bg_color = ""
|
||||
const git_bg_color_unstable = ""
|
||||
const git_bg_color_urgent = ""
|
||||
const git_color_branch = ""
|
||||
const git_color_conflicted = ""
|
||||
const git_color_dirty = ""
|
||||
const git_color_operation = ""
|
||||
const git_color_staged = ""
|
||||
const git_color_stash = ""
|
||||
const git_color_untracked = ""
|
||||
const git_color_upstream = ""
|
||||
|
||||
# os
|
||||
let os_bg_color_24 = (ansi -e { bg: "#CED7CF" })
|
||||
let os_color_24 = (ansi -e { fg: "#080808" })
|
||||
let os_bg_color_8 = $"(ansi idx_bg)188m"
|
||||
let os_color_8 = $"(ansi idx_fg)232m"
|
||||
let os_bg_color = ""
|
||||
let os_color = ""
|
||||
const os_bg_color_24 = (ansi -e { bg: "#CED7CF" })
|
||||
const os_color_24 = (ansi -e { fg: "#080808" })
|
||||
const os_bg_color_8 = $"(ansi idx_bg)188m"
|
||||
const os_color_8 = $"(ansi idx_fg)232m"
|
||||
const os_bg_color = ""
|
||||
const os_color = ""
|
||||
|
||||
# pwd
|
||||
let pwd_bg_color_24 = (ansi -e { bg: "#3465A4" })
|
||||
let pwd_color_anchors_24 = (ansi -e { fg: "#E4E4E4" })
|
||||
let pwd_color_dirs_24 = (ansi -e { fg: "#E4E4E4" })
|
||||
let pwd_color_truncated_dirs_24 = (ansi -e { fg: "#BCBCBC" })
|
||||
const pwd_bg_color_24 = (ansi -e { bg: "#3465A4" })
|
||||
const pwd_color_anchors_24 = (ansi -e { fg: "#E4E4E4" })
|
||||
const pwd_color_dirs_24 = (ansi -e { fg: "#E4E4E4" })
|
||||
const pwd_color_truncated_dirs_24 = (ansi -e { fg: "#BCBCBC" })
|
||||
|
||||
let pwd_bg_color_8 = $"(ansi idx_bg)61m"
|
||||
let pwd_color_anchors_8 = $"(ansi idx_fg)254m"
|
||||
let pwd_color_dirs_8 = $"(ansi idx_fg)254m"
|
||||
let pwd_color_truncated_dirs_8 = $"(ansi idx_fg)250m"
|
||||
const pwd_bg_color_8 = $"(ansi idx_bg)61m"
|
||||
const pwd_color_anchors_8 = $"(ansi idx_fg)254m"
|
||||
const pwd_color_dirs_8 = $"(ansi idx_fg)254m"
|
||||
const pwd_color_truncated_dirs_8 = $"(ansi idx_fg)250m"
|
||||
|
||||
let pwd_bg_color = ""
|
||||
let pwd_color_anchors = ""
|
||||
let pwd_color_dirs = ""
|
||||
let pwd_color_truncated_dirs = ""
|
||||
let pwd_icon = ""
|
||||
let pwd_icon_home = ""
|
||||
let pwd_icon_unwritable = ""
|
||||
let pwd_markers = []
|
||||
const pwd_bg_color = ""
|
||||
const pwd_color_anchors = ""
|
||||
const pwd_color_dirs = ""
|
||||
const pwd_color_truncated_dirs = ""
|
||||
const pwd_icon = ""
|
||||
const pwd_icon_home = ""
|
||||
const pwd_icon_unwritable = ""
|
||||
const pwd_markers = []
|
||||
|
||||
# rustc
|
||||
let rustc_bg_color_24 = (ansi -e { bg: "#F74C00" })
|
||||
let rustc_color_24 = (ansi -e { fg: "#000000" })
|
||||
let rustc_bg_color_8 = $"(ansi idx_bg)202m"
|
||||
let rustc_color_8 = $"(ansi idx_fg)16m"
|
||||
const rustc_bg_color_24 = (ansi -e { bg: "#F74C00" })
|
||||
const rustc_color_24 = (ansi -e { fg: "#000000" })
|
||||
const rustc_bg_color_8 = $"(ansi idx_bg)202m"
|
||||
const rustc_color_8 = $"(ansi idx_fg)16m"
|
||||
|
||||
let rustc_bg_color = ""
|
||||
let rustc_color = ""
|
||||
let rustc_icon = ""
|
||||
const rustc_bg_color = ""
|
||||
const rustc_color = ""
|
||||
const rustc_icon = ""
|
||||
|
||||
# status
|
||||
let status_bg_color_24 = (ansi -e { bg: "#2E3436" })
|
||||
let status_bg_color_failure_24 = (ansi -e { bg: "#CC0000" })
|
||||
let status_color_24 = (ansi -e { fg: "#4E9A06" })
|
||||
let status_color_failure_24 = (ansi -e { fg: "#FFFF00" })
|
||||
const status_bg_color_24 = (ansi -e { bg: "#2E3436" })
|
||||
const status_bg_color_failure_24 = (ansi -e { bg: "#CC0000" })
|
||||
const status_color_24 = (ansi -e { fg: "#4E9A06" })
|
||||
const status_color_failure_24 = (ansi -e { fg: "#FFFF00" })
|
||||
|
||||
let status_bg_color_8 = $"(ansi idx_bg)236m"
|
||||
let status_bg_color_failure_8 = $"(ansi idx_bg)160m"
|
||||
let status_color_8 = $"(ansi idx_fg)70m"
|
||||
let status_color_failure_8 = $"(ansi idx_fg)226m"
|
||||
const status_bg_color_8 = $"(ansi idx_bg)236m"
|
||||
const status_bg_color_failure_8 = $"(ansi idx_bg)160m"
|
||||
const status_color_8 = $"(ansi idx_fg)70m"
|
||||
const status_color_failure_8 = $"(ansi idx_fg)226m"
|
||||
|
||||
let status_bg_color = ""
|
||||
let status_bg_color_faiure = ""
|
||||
let status_color = ""
|
||||
let status_color_failure = ""
|
||||
let status_icon = ""
|
||||
let status_icon_failure = ""
|
||||
const status_bg_color = ""
|
||||
const status_bg_color_failure = ""
|
||||
const status_color = ""
|
||||
const status_color_failure = ""
|
||||
const status_icon = ""
|
||||
const status_icon_failure = ""
|
||||
|
||||
# time
|
||||
let time_bg_color_24 = (ansi -e { bg: "#D3D7CF" })
|
||||
let time_color_24 = (ansi -e { fg: "#000000" })
|
||||
let time_bg_color_8 = $"(ansi idx_bg)188m"
|
||||
let time_color_8 = $"(ansi idx_fg)16m"
|
||||
const time_bg_color_24 = (ansi -e { bg: "#D3D7CF" })
|
||||
const time_color_24 = (ansi -e { fg: "#000000" })
|
||||
const time_bg_color_8 = $"(ansi idx_bg)188m"
|
||||
const time_color_8 = $"(ansi idx_fg)16m"
|
||||
|
||||
let time_bg_color = ""
|
||||
let time_color = ""
|
||||
let time_format = ""
|
||||
const time_bg_color = ""
|
||||
const time_color = ""
|
||||
const time_format = ""
|
||||
|
||||
# indicator
|
||||
let indicator_color_24 = (ansi -e { fg: "#3465a4" })
|
||||
let indicator_bg_color_24 = (ansi -e { bg: "#000000" })
|
||||
let indicator_color_8 = $"(ansi idx_fg)61m"
|
||||
let indicator_bg_color_8 = $"(ansi idx_bg)16m"
|
||||
const indicator_color_24 = (ansi -e { fg: "#3465a4" })
|
||||
const indicator_bg_color_24 = (ansi -e { bg: "#000000" })
|
||||
const indicator_color_8 = $"(ansi idx_fg)61m"
|
||||
const indicator_bg_color_8 = $"(ansi idx_bg)16m"
|
||||
|
||||
# terminal background color
|
||||
let terminal_color_24 = (ansi -e { fg: "#c7c7c7" })
|
||||
let terminal_color_8 = (ansi white)
|
||||
let terminal_bg_color_24 = (ansi -e { bg: "#000000" })
|
||||
let terminal_bg_color_8 = (ansi black)
|
||||
const terminal_color_24 = (ansi -e { fg: "#c7c7c7" })
|
||||
const terminal_color_8 = (ansi white)
|
||||
const terminal_bg_color_24 = (ansi -e { bg: "#000000" })
|
||||
const terminal_bg_color_8 = (ansi black)
|
||||
|
||||
# cmd_duration_ms
|
||||
let cmd_duration_ms_color_24 = (ansi -e { fg: "#606060" })
|
||||
let cmd_duration_ms_color_8 = $"(ansi idx_fg)244m"
|
||||
let cmd_duration_ms_bg_color_24 = (ansi -e { fg: "#000000" })
|
||||
let cmd_duration_ms_bg_color_8 = (ansi black)
|
||||
const cmd_duration_ms_color_24 = (ansi -e { fg: "#606060" })
|
||||
const cmd_duration_ms_color_8 = $"(ansi idx_fg)244m"
|
||||
const cmd_duration_ms_bg_color_24 = (ansi -e { fg: "#000000" })
|
||||
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_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 },
|
||||
|
|
1250
modules/yadm/mod.nu
1250
modules/yadm/mod.nu
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,7 @@
|
|||
# round an integer amount of nanoseconds to 4th digit and convert to a real duration
|
||||
def "from ns" [] {
|
||||
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
|
||||
}
|
||||
| into duration
|
||||
|
|
|
@ -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
|
||||
# def main [
|
||||
# x: string, # list<int>
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use ./col-indices.nu *
|
||||
|
||||
# Relect a range of columns by their indices
|
||||
# Reject a range of columns by their indices
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
#
|
||||
# ls | reject column-ranges 0 4 5 | first 3
|
||||
export def "reject column-ranges" [
|
||||
...ranges
|
||||
] {
|
||||
let column_selector = ($in | col-indices ...$ranges)
|
||||
$in | reject ...$column_selector
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use ./row-indices.nu *
|
|||
# ls / | select 5
|
||||
#
|
||||
# Example - Select the 4th row.
|
||||
# Note that the difference beteen this
|
||||
# Note that the difference between this
|
||||
# and `select 3` is that the index (#)
|
||||
# column shows the *original* (pre-select)
|
||||
# position in the table.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue