mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
use typos
for corrections (#833)
I used [typos](https://github.com/crate-ci/typos/). I manually checked all the corrections and they seem safe to me. There are still some left, but those in this PR are good
This commit is contained in:
parent
a0aa600153
commit
afde2592a6
42 changed files with 102 additions and 90 deletions
|
@ -65,7 +65,7 @@ An extensive example of a wrapper for docker operations, with nushell completion
|
|||
|
||||
- [bm](./filesystem/bm.nu) - A Simple bookmarking module. It uses `XGD_DATA_HOME` to save bookmarks.
|
||||
- [expand](./filesystem/expand.nu) - expansion module that implements bashes brace expansion.
|
||||
The expansion uses a list inside of braces seperated by `,` to expand into a list of multiple string variations like:
|
||||
The expansion uses a list inside of braces separated by `,` to expand into a list of multiple string variations like:
|
||||
```
|
||||
expand a/{b,c}/d{e,f,g}.nu{,on}
|
||||
```
|
||||
|
|
|
@ -50,7 +50,7 @@ with-env { FOO: ($foo | to json) } {
|
|||
|
||||
### How can I reuse custom commands in a background task?
|
||||
|
||||
You can define these commands in a seperate module, like so:
|
||||
You can define these commands in a separate module, like so:
|
||||
|
||||
```nu
|
||||
# --- in foo.nu ---
|
||||
|
@ -65,4 +65,4 @@ task spawn {
|
|||
```
|
||||
## Troubleshooting
|
||||
|
||||
- On some setups (e.g. NixOS with `nu` installed as a binary in user's `$HOME`), `sh` (which `pueue` delegates tasks to run) might fail to find `nu` in the `$PATH`. In this case hard-coding the location of your nu binary in the `task spawn` function definiton in `task.nu` can solve the issue.
|
||||
- On some setups (e.g. NixOS with `nu` installed as a binary in user's `$HOME`), `sh` (which `pueue` delegates tasks to run) might fail to find `nu` in the `$PATH`. In this case hard-coding the location of your nu binary in the `task spawn` function definition in `task.nu` can solve the issue.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# grabs the repo name of a github (ORG/repo) string
|
||||
#
|
||||
# for exaple
|
||||
# for example
|
||||
# grab repo name "organization/my_special_repo"
|
||||
# returns "myspecial_repo"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
# A bash like quick string manipulation script
|
||||
# the script works by creating a list from brace contents, seperated by a brace.
|
||||
# the script works by creating a list from brace contents, separated by a brace.
|
||||
|
||||
# Expand the given string into a list on braces like bashes brace expansion
|
||||
export def main [
|
||||
|
@ -38,8 +38,8 @@ export def help [] {
|
|||
$"(ansi green)Examples(ansi reset):"
|
||||
$" > (ansi light_green)expand (ansi green)a/{b,c}/d(ansi reset)"
|
||||
$"╭───┬───────╮\n│ 0 │ a/b/d │\n│ 1 │ a/c/d │\n╰───┴───────╯"
|
||||
$" > (ansi light_green)expand (ansi green)\"my {beautifull,ugly} duckling\"(ansi reset)"
|
||||
$"╭───┬────────────────────────╮\n│ 0 │ my beautifull duckling │\n│ 1 │ my ugly duckling │\n╰───┴────────────────────────╯"
|
||||
$" > (ansi light_green)expand (ansi green)\"my {beautiful,ugly} duckling\"(ansi reset)"
|
||||
$"╭───┬────────────────────────╮\n│ 0 │ my beautiful duckling │\n│ 1 │ my ugly duckling │\n╰───┴────────────────────────╯"
|
||||
$" > (ansi light_green)expand (ansi green).config/nushell/config.nu{,on}(ansi reset)"
|
||||
$"╭───┬─────────────────────────────╮\n│ 0 │ .config/nushell/config.nu │\n│ 1 │ .config/nushell/config.nuon │\n╰───┴─────────────────────────────╯"
|
||||
$" > (ansi light_green)expand (ansi green)a/{b,c}/{d,e,f,g} (ansi reset)(ansi purple)|(ansi reset)(ansi light_green) each(ansi reset) (ansi light_green){ |d| (ansi reset)(ansi light_green) mkdir(ansi reset) (ansi purple)$d (ansi reset)(ansi light_green)}(ansi reset);(ansi light_green)tree(ansi reset)"
|
||||
|
|
|
@ -91,7 +91,7 @@ export def isleap [year: int] {
|
|||
if ( (($year mod 4) == 0 and ($year mod 100) != 0) or ($year mod 400) == 0 ) { echo "It is a leap year." } else { echo "It is not a leap year."}
|
||||
}
|
||||
|
||||
#Greatest common divisior (gcd) between 2 integers
|
||||
#Greatest common divisor (gcd) between 2 integers
|
||||
export def gcd [a: int, b:int] {
|
||||
if $a < $b {
|
||||
gcd $b $a
|
||||
|
|
|
@ -8,7 +8,7 @@ These scripts should be used to draw a custom command prompt in nushell. They ca
|
|||
|
||||
File is in [starship](./starship.nu)
|
||||
|
||||
This discribe how to use starship to make a leftprompt, the repo of starship is [here](https://github.com/starship/starship).
|
||||
This describe how to use starship to make a leftprompt, the repo of starship is [here](https://github.com/starship/starship).
|
||||
|
||||
This script set the output of starship as leftprompt
|
||||
|
||||
|
@ -18,7 +18,7 @@ This script set the output of starship as leftprompt
|
|||
|
||||
File is in [shell_space](./shell_space.nu)
|
||||
|
||||
Use the function of shells in nu, you can view the fucntion with the command following
|
||||
Use the function of shells in nu, you can view the function with the command following
|
||||
|
||||
```
|
||||
help shells
|
||||
|
|
|
@ -20,7 +20,7 @@ def even [n: int, acc=true] -> any {
|
|||
}
|
||||
|
||||
|
||||
# Returns true if number is odd. Will cooperate with even in a mutually recursive fashon.
|
||||
# Returns true if number is odd. Will cooperate with even in a mutually recursive fashion.
|
||||
# Warning: do not pass any numbers less than 0
|
||||
def odd [n: int, acc=true] -> bool {
|
||||
if $n == 0 { return (not $acc) } else if $n == 1 {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Euclid's algorythm for determining greatest common divisor between 2 positive integers
|
||||
# Baed on this clear explanation from Rutgers: https://sites.math.rutgers.edu/~greenfie/gs2004/euclid.html
|
||||
# Euclid's algorithm for determining greatest common divisor between 2 positive integers
|
||||
# Based on this clear explanation from Rutgers: https://sites.math.rutgers.edu/~greenfie/gs2004/euclid.html
|
||||
|
||||
# Returns the GCD of its 2 arguments
|
||||
def gcd [i1: int, i2: int] -> int {
|
||||
|
|
|
@ -101,7 +101,7 @@ def check-if-env-exists [ env_name: string, conda_info: record ] {
|
|||
|
||||
let en = ($env_dirs | each {|en| $conda_info.envs | where $it == $en } | where ($it | length) == 1 | flatten)
|
||||
if ($en | length) > 1 {
|
||||
error make --unspanned {msg: $"You have enviroments in multiple locations: ($en)"}
|
||||
error make --unspanned {msg: $"You have environments in multiple locations: ($en)"}
|
||||
}
|
||||
if ($en | length) == 0 {
|
||||
error make --unspanned {msg: $"Could not find given environment: ($env_name)"}
|
||||
|
|
|
@ -122,7 +122,7 @@ def check-if-env-exists [ env_name: string, conda_info: record ] {
|
|||
|
||||
let en = ($env_dirs | each {|en| $conda_info.envs | where $it == $en } | where ($it | length) == 1 | flatten)
|
||||
if ($en | length) > 1 {
|
||||
error make --unspanned {msg: $"You have enviroments in multiple locations: ($en)"}
|
||||
error make --unspanned {msg: $"You have environments in multiple locations: ($en)"}
|
||||
}
|
||||
if ($en | length) == 0 {
|
||||
error make --unspanned {msg: $"Could not find given environment: ($env_name)"}
|
||||
|
|
|
@ -56,7 +56,7 @@ def show-error [msg label err] {
|
|||
def get_weather_by_ip [locIdx: int, units: string, token: string] {
|
||||
# units
|
||||
# f = imperial aka Fahrenheit
|
||||
# c = metric aka Celcius
|
||||
# c = metric aka Celsius
|
||||
let URL_WEATHER = "https://api.openweathermap.org/data/2.5/weather"
|
||||
let URL_FORECAST = "http://api.openweathermap.org/data/2.5/forecast/daily"
|
||||
let coords = (get_location_by_ip $locIdx $token)
|
||||
|
@ -300,7 +300,7 @@ def get_emoji_by_id [id] {
|
|||
# > get_weather -l 1
|
||||
# This changes to location 1. Locations are listed in the locations custom command above
|
||||
# > get_weather -l 2 -u c
|
||||
# This uses location 2 and Celcius degrees. f = Fahrenheit, c = Celcius
|
||||
# This uses location 2 and Celsius degrees. f = Fahrenheit, c = Celsius
|
||||
|
||||
# Since I live in the USA I have not tested outside the country.
|
||||
# We'll take PRs for things that are broke or augmentations.
|
||||
|
@ -309,5 +309,5 @@ def get_emoji_by_id [id] {
|
|||
# put this in your config.nu file
|
||||
# use /path/to/get-weather.nu get_weather
|
||||
#
|
||||
# then from the nushell commmand prompt type
|
||||
# then from the nushell command prompt type
|
||||
# get_weather
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
# 2. if the interval has not expired yet, it prints the Cached information
|
||||
# 3. if the interval has expired, it runs the weather command again and caches the info
|
||||
|
||||
# this script is depenedent on get-weather
|
||||
# this script is dependent on get-weather
|
||||
source get-weather.nu
|
||||
|
||||
#command to run at interval
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
# I wrote this so I could have weather in my prompt but not pay the price of hitting
|
||||
# the web for every prompt.
|
||||
|
||||
# this script is depenedent on get-weather
|
||||
# this script is dependent on get-weather
|
||||
use get-weather.nu get_weather
|
||||
|
||||
# Create a mutable weather table to hold the weather data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Weather Script based on IP Address
|
||||
# - Weather using dark weather api
|
||||
# - Air polution condition using airvisual api
|
||||
# - Air pollution condition using airvisual api
|
||||
# - Street address using google maps api
|
||||
# - Version 2.0
|
||||
export def --env weatherds [] {
|
||||
|
@ -62,7 +62,7 @@ def get_airCond [loc] {
|
|||
let url = $"https://api.airvisual.com/v2/nearest_city?lat=($lat)&lon=($lon)&key=($apiKey)"
|
||||
let aqius = (http get $url).data.current.pollution.aqius
|
||||
|
||||
# clasification (standard)
|
||||
# classification (standard)
|
||||
if $aqius < 51 { "Good" } else if $aqius < 101 { "Moderate" } else if $aqius < 151 { "Unhealthy for some" } else if $aqius < 201 { "Unhealthy" } else if $aqius < 301 { "Very unhealthy" } else { "Hazardous" }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue