mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
upgrade to 0.86 (#640)
- upgrade to 0.86 - power.nu: new time's colorscheme `rainbow` Co-authored-by: agent <agent@nuc>
This commit is contained in:
parent
35669a39a9
commit
0a030b524b
5 changed files with 94 additions and 87 deletions
|
@ -280,9 +280,9 @@ def host-path [path] {
|
||||||
|
|
||||||
# run
|
# run
|
||||||
export def container-create [
|
export def container-create [
|
||||||
--debug(-x): bool
|
--debug(-x)
|
||||||
--appimage: bool
|
--appimage
|
||||||
--netadmin: bool
|
--netadmin
|
||||||
--proxy: string@"nu-complete docker run proxy" # proxy
|
--proxy: string@"nu-complete docker run proxy" # proxy
|
||||||
--ssh(-s): string@"nu-complete docker run sshkey" # specify ssh key
|
--ssh(-s): string@"nu-complete docker run sshkey" # specify ssh key
|
||||||
--sshuser: string=root # default root
|
--sshuser: string=root # default root
|
||||||
|
@ -291,13 +291,13 @@ export def container-create [
|
||||||
--vols(-v): any # { host: container }
|
--vols(-v): any # { host: container }
|
||||||
--ports(-p): any # { 8080: 80 }
|
--ports(-p): any # { 8080: 80 }
|
||||||
--envs(-e): any # { FOO: BAR }
|
--envs(-e): any # { FOO: BAR }
|
||||||
--daemon(-d): bool
|
--daemon(-d)
|
||||||
--attach(-a): string@"nu-complete docker container" # attach
|
--attach(-a): string@"nu-complete docker container" # attach
|
||||||
--workdir(-w): string # workdir
|
--workdir(-w): string # workdir
|
||||||
--entrypoint: string # entrypoint
|
--entrypoint: string # entrypoint
|
||||||
--dry-run: bool
|
--dry-run
|
||||||
--with-x: bool
|
--with-x
|
||||||
--privileged(-P): bool
|
--privileged(-P)
|
||||||
--namespace(-n): string@"nu-complete docker ns"
|
--namespace(-n): string@"nu-complete docker ns"
|
||||||
img: string@"nu-complete docker images" # image
|
img: string@"nu-complete docker images" # image
|
||||||
...cmd # command args
|
...cmd # command args
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
def agree [
|
def agree [
|
||||||
prompt
|
prompt
|
||||||
--default-not (-n): bool
|
--default-not (-n)
|
||||||
] {
|
] {
|
||||||
let prompt = if ($prompt | str ends-with '!') {
|
let prompt = if ($prompt | str ends-with '!') {
|
||||||
$'(ansi red)($prompt)(ansi reset)'
|
$'(ansi red)($prompt)(ansi reset)'
|
||||||
|
@ -100,14 +100,14 @@ export def gs [] {
|
||||||
|
|
||||||
# git stash
|
# git stash
|
||||||
export def gst [
|
export def gst [
|
||||||
--apply (-a): bool
|
--apply (-a)
|
||||||
--clear (-c): bool
|
--clear (-c)
|
||||||
--drop (-d): bool
|
--drop (-d)
|
||||||
--list (-l): bool
|
--list (-l)
|
||||||
--pop (-p): bool
|
--pop (-p)
|
||||||
--show (-s): bool
|
--show (-s)
|
||||||
--all (-A): bool
|
--all (-A)
|
||||||
--include-untracked (-i): bool
|
--include-untracked (-i)
|
||||||
] {
|
] {
|
||||||
if $apply {
|
if $apply {
|
||||||
git stash apply
|
git stash apply
|
||||||
|
@ -131,7 +131,7 @@ export def gst [
|
||||||
# git log
|
# git log
|
||||||
export def gl [
|
export def gl [
|
||||||
commit?: string@"nu-complete git log"
|
commit?: string@"nu-complete git log"
|
||||||
--verbose(-v):bool
|
--verbose(-v)
|
||||||
--num(-n):int=32
|
--num(-n):int=32
|
||||||
] {
|
] {
|
||||||
if ($commit|is-empty) {
|
if ($commit|is-empty) {
|
||||||
|
@ -145,8 +145,8 @@ export def gl [
|
||||||
export def gb [
|
export def gb [
|
||||||
branch?: string@"nu-complete git branches"
|
branch?: string@"nu-complete git branches"
|
||||||
remote?: string@"nu-complete git remote branches"
|
remote?: string@"nu-complete git remote branches"
|
||||||
--delete (-d): bool
|
--delete (-d)
|
||||||
--no-merged (-n): bool
|
--no-merged (-n)
|
||||||
] {
|
] {
|
||||||
let bs = (git branch | lines | each {|x| $x | str substring 2..})
|
let bs = (git branch | lines | each {|x| $x | str substring 2..})
|
||||||
if ($branch | is-empty) {
|
if ($branch | is-empty) {
|
||||||
|
@ -178,8 +178,8 @@ export def gb [
|
||||||
export def-env gn [
|
export def-env gn [
|
||||||
repo?: string@"nu-complete git branches"
|
repo?: string@"nu-complete git branches"
|
||||||
local?: path
|
local?: path
|
||||||
--submodule (-s): bool # git submodule
|
--submodule (-s) # git submodule
|
||||||
--init (-i): bool # git init
|
--init (-i) # git init
|
||||||
] {
|
] {
|
||||||
if $init {
|
if $init {
|
||||||
if ($repo | is-empty) {
|
if ($repo | is-empty) {
|
||||||
|
@ -211,13 +211,13 @@ export def gig [] {
|
||||||
export def gp [
|
export def gp [
|
||||||
branch?: string@"nu-complete git remote branches"
|
branch?: string@"nu-complete git remote branches"
|
||||||
remote?: string@"nu-complete git remote branches"
|
remote?: string@"nu-complete git remote branches"
|
||||||
--force (-f): bool # git push -f
|
--force (-f) # git push -f
|
||||||
--override: bool
|
--override
|
||||||
--submodule (-s): bool # git submodule
|
--submodule (-s) # git submodule
|
||||||
--init (-i): bool # git init
|
--init (-i) # git init
|
||||||
--merge (-m): bool # git pull (no)--rebase
|
--merge (-m) # git pull (no)--rebase
|
||||||
--autostash (-a): bool # git pull --autostash
|
--autostash (-a) # git pull --autostash
|
||||||
--back-to-prev (-b): bool # back to branch
|
--back-to-prev (-b) # back to branch
|
||||||
] {
|
] {
|
||||||
if $submodule {
|
if $submodule {
|
||||||
git submodule update
|
git submodule update
|
||||||
|
@ -284,15 +284,15 @@ export def gp [
|
||||||
# git add, rm and restore
|
# git add, rm and restore
|
||||||
export def ga [
|
export def ga [
|
||||||
file?: path
|
file?: path
|
||||||
--all (-A): bool
|
--all (-A)
|
||||||
--patch (-p): bool
|
--patch (-p)
|
||||||
--update (-u): bool
|
--update (-u)
|
||||||
--verbose (-v): bool
|
--verbose (-v)
|
||||||
--delete (-d): bool # git rm
|
--delete (-d) # git rm
|
||||||
--cached (-c): bool
|
--cached (-c)
|
||||||
--force (-f): bool
|
--force (-f)
|
||||||
--restore (-r): bool # git restore
|
--restore (-r) # git restore
|
||||||
--staged (-s): bool
|
--staged (-s)
|
||||||
--source (-o): string
|
--source (-o): string
|
||||||
] {
|
] {
|
||||||
if $delete {
|
if $delete {
|
||||||
|
@ -318,9 +318,9 @@ export def ga [
|
||||||
# git commit
|
# git commit
|
||||||
export def gc [
|
export def gc [
|
||||||
message?: string
|
message?: string
|
||||||
--all (-A): bool
|
--all (-A)
|
||||||
--amend (-a): bool
|
--amend (-a)
|
||||||
--keep (-k): bool
|
--keep (-k)
|
||||||
] {
|
] {
|
||||||
let m = (spr [-m $message])
|
let m = (spr [-m $message])
|
||||||
let a = (sprb $all [--all])
|
let a = (sprb $all [--all])
|
||||||
|
@ -332,9 +332,9 @@ export def gc [
|
||||||
# git diff
|
# git diff
|
||||||
export def gd [
|
export def gd [
|
||||||
file?: path
|
file?: path
|
||||||
--cached (-c): bool # cached
|
--cached (-c) # cached
|
||||||
--word-diff (-w): bool # word-diff
|
--word-diff (-w) # word-diff
|
||||||
--staged (-s): bool # staged
|
--staged (-s) # staged
|
||||||
] {
|
] {
|
||||||
let w = (sprb $word_diff [--word-diff])
|
let w = (sprb $word_diff [--word-diff])
|
||||||
let c = (sprb $cached [--cached])
|
let c = (sprb $cached [--cached])
|
||||||
|
@ -345,10 +345,10 @@ export def gd [
|
||||||
# git merge
|
# git merge
|
||||||
export def gm [
|
export def gm [
|
||||||
branch?: string@"nu-complete git branches"
|
branch?: string@"nu-complete git branches"
|
||||||
--abort (-a): bool
|
--abort (-a)
|
||||||
--continue (-c): bool
|
--continue (-c)
|
||||||
--quit (-q): bool
|
--quit (-q)
|
||||||
--no-squash (-n): bool # git merge (no)--squash
|
--no-squash (-n) # git merge (no)--squash
|
||||||
] {
|
] {
|
||||||
let x = if $no_squash { [] } else { [--squash] }
|
let x = if $no_squash { [] } else { [--squash] }
|
||||||
if ($branch | is-empty) {
|
if ($branch | is-empty) {
|
||||||
|
@ -365,12 +365,12 @@ export def gm [
|
||||||
# TODO: --onto: (commit_id)
|
# TODO: --onto: (commit_id)
|
||||||
export def gr [
|
export def gr [
|
||||||
branch?: string@"nu-complete git branches"
|
branch?: string@"nu-complete git branches"
|
||||||
--interactive (-i): bool
|
--interactive (-i)
|
||||||
--onto (-o): string
|
--onto (-o): string
|
||||||
--abort (-a): bool
|
--abort (-a)
|
||||||
--continue (-c): bool
|
--continue (-c)
|
||||||
--skip (-s): bool
|
--skip (-s)
|
||||||
--quit (-q): bool
|
--quit (-q)
|
||||||
] {
|
] {
|
||||||
if $abort {
|
if $abort {
|
||||||
git rebase --abort
|
git rebase --abort
|
||||||
|
@ -395,10 +395,10 @@ export def gr [
|
||||||
# git cherry-pick
|
# git cherry-pick
|
||||||
export def gcp [
|
export def gcp [
|
||||||
commit?: string@"nu-complete git log all"
|
commit?: string@"nu-complete git log all"
|
||||||
--abort (-a): bool
|
--abort (-a)
|
||||||
--continue (-c): bool
|
--continue (-c)
|
||||||
--skip (-s): bool
|
--skip (-s)
|
||||||
--quit (-q): bool
|
--quit (-q)
|
||||||
] {
|
] {
|
||||||
if $abort {
|
if $abort {
|
||||||
git cherry-pick --abort
|
git cherry-pick --abort
|
||||||
|
@ -424,8 +424,8 @@ export def gcf [
|
||||||
# git reset
|
# git reset
|
||||||
export def grs [
|
export def grs [
|
||||||
commit?: string@"nu-complete git log"
|
commit?: string@"nu-complete git log"
|
||||||
--hard (-h): bool
|
--hard (-h)
|
||||||
--clean (-c): bool
|
--clean (-c)
|
||||||
] {
|
] {
|
||||||
let h = (sprb $hard [--hard])
|
let h = (sprb $hard [--hard])
|
||||||
let cm = (spr [$commit])
|
let cm = (spr [$commit])
|
||||||
|
@ -440,11 +440,11 @@ export def grs [
|
||||||
export def grm [
|
export def grm [
|
||||||
remote?: string@"nu-complete git remotes"
|
remote?: string@"nu-complete git remotes"
|
||||||
uri?: string
|
uri?: string
|
||||||
--add (-a): bool
|
--add (-a)
|
||||||
--rename (-r): bool
|
--rename (-r)
|
||||||
--delete (-d): bool
|
--delete (-d)
|
||||||
--update (-u): bool
|
--update (-u)
|
||||||
--set (-s): bool
|
--set (-s)
|
||||||
] {
|
] {
|
||||||
if ($remote | is-empty) {
|
if ($remote | is-empty) {
|
||||||
git remote -v
|
git remote -v
|
||||||
|
@ -467,10 +467,10 @@ export def grm [
|
||||||
|
|
||||||
# git bisect
|
# git bisect
|
||||||
export def gbs [
|
export def gbs [
|
||||||
--bad (-b): bool
|
--bad (-b)
|
||||||
--good (-g): bool
|
--good (-g)
|
||||||
--reset (-r): bool
|
--reset (-r)
|
||||||
--start (-s): bool
|
--start (-s)
|
||||||
] {
|
] {
|
||||||
if $good {
|
if $good {
|
||||||
git bisect good
|
git bisect good
|
||||||
|
|
|
@ -78,7 +78,7 @@ export def normalize-column-names [ ] {
|
||||||
let cols = ($i | columns)
|
let cols = ($i | columns)
|
||||||
mut t = $i
|
mut t = $i
|
||||||
for c in $cols {
|
for c in $cols {
|
||||||
$t = ($t | rename -c [$c ($c | str downcase | str replace ' ' '_')])
|
$t = ($t | rename -c {$c: ($c | str downcase | str replace ' ' '_')})
|
||||||
}
|
}
|
||||||
$t
|
$t
|
||||||
}
|
}
|
||||||
|
@ -160,9 +160,9 @@ export def kk [p: path] {
|
||||||
export def kgh [
|
export def kgh [
|
||||||
name?: string@"nu-complete helm list"
|
name?: string@"nu-complete helm list"
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--manifest (-m): bool
|
--manifest (-m)
|
||||||
--values(-v): bool
|
--values(-v)
|
||||||
--all (-a): bool
|
--all (-a)
|
||||||
] {
|
] {
|
||||||
if ($name | is-empty) {
|
if ($name | is-empty) {
|
||||||
let ns = if $all { [--all] } else { (spr [-n $namespace]) }
|
let ns = if $all { [--all] } else { (spr [-n $namespace]) }
|
||||||
|
@ -228,7 +228,7 @@ export def kdh [
|
||||||
valuefile: path
|
valuefile: path
|
||||||
--values (-v): any
|
--values (-v): any
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--has-plugin (-h): bool
|
--has-plugin (-h)
|
||||||
] {
|
] {
|
||||||
if $has_plugin {
|
if $has_plugin {
|
||||||
helm diff $name $chart -f $valuefile (spr [-n $namespace])
|
helm diff $name $chart -f $valuefile (spr [-n $namespace])
|
||||||
|
@ -491,10 +491,10 @@ export def kg [
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--jsonpath (-p): string@"nu-complete kube jsonpath"
|
--jsonpath (-p): string@"nu-complete kube jsonpath"
|
||||||
--selector (-l): string
|
--selector (-l): string
|
||||||
--verbose (-v): bool
|
--verbose (-v)
|
||||||
--watch (-w): bool
|
--watch (-w)
|
||||||
--wide (-W): bool
|
--wide (-W)
|
||||||
--all (-a): bool
|
--all (-a)
|
||||||
] {
|
] {
|
||||||
let n = if $all {
|
let n = if $all {
|
||||||
[-A]
|
[-A]
|
||||||
|
@ -584,7 +584,7 @@ export def kdel [
|
||||||
r: string@"nu-complete kube kind"
|
r: string@"nu-complete kube kind"
|
||||||
i: string@"nu-complete kube res"
|
i: string@"nu-complete kube res"
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--force(-f): bool
|
--force(-f)
|
||||||
] {
|
] {
|
||||||
kubectl delete (spr [-n $namespace]) (sprb $force [--grace-period=0 --force]) $r $i
|
kubectl delete (spr [-n $namespace]) (sprb $force [--grace-period=0 --force]) $r $i
|
||||||
}
|
}
|
||||||
|
@ -619,7 +619,7 @@ export def kgp [
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--jsonpath (-p): string@"nu-complete kube jsonpath"
|
--jsonpath (-p): string@"nu-complete kube jsonpath"
|
||||||
--selector (-l): string
|
--selector (-l): string
|
||||||
--all (-a): bool
|
--all (-a)
|
||||||
] {
|
] {
|
||||||
if $all {
|
if $all {
|
||||||
kg pods -a --wide
|
kg pods -a --wide
|
||||||
|
@ -700,8 +700,8 @@ export def kl [
|
||||||
pod: string@"nu-complete kube pods"
|
pod: string@"nu-complete kube pods"
|
||||||
--namespace(-n): string@"nu-complete kube ns"
|
--namespace(-n): string@"nu-complete kube ns"
|
||||||
--container(-c): string@"nu-complete kube ctns"
|
--container(-c): string@"nu-complete kube ctns"
|
||||||
--follow(-f): bool
|
--follow(-f)
|
||||||
--previous(-p): bool
|
--previous(-p)
|
||||||
] {
|
] {
|
||||||
let n = (spr [-n $namespace])
|
let n = (spr [-n $namespace])
|
||||||
let c = (spr [-c $container])
|
let c = (spr [-c $container])
|
||||||
|
@ -882,7 +882,7 @@ export alias krsss = kubectl rollout status statefulset
|
||||||
# kubectl top pod
|
# kubectl top pod
|
||||||
export def ktp [
|
export def ktp [
|
||||||
--namespace (-n): string@"nu-complete kube ns"
|
--namespace (-n): string@"nu-complete kube ns"
|
||||||
--all(-a): bool
|
--all(-a)
|
||||||
] {
|
] {
|
||||||
if $all {
|
if $all {
|
||||||
kubectl top pod -A | from ssv -a | rename namespace name cpu mem
|
kubectl top pod -A | from ssv -a | rename namespace name cpu mem
|
||||||
|
|
|
@ -12,7 +12,7 @@ use power.nu
|
||||||
}
|
}
|
||||||
use power_utils.nu
|
use power_utils.nu
|
||||||
power inject 0 1 {source: atuin, color: '#4C4B4A'}
|
power inject 0 1 {source: atuin, color: '#4C4B4A'}
|
||||||
power set time null { short: false }
|
power set time null { style: compact }
|
||||||
power init
|
power init
|
||||||
```
|
```
|
||||||
or
|
or
|
||||||
|
|
|
@ -79,10 +79,17 @@ def time_segment [] {
|
||||||
{|bg|
|
{|bg|
|
||||||
let config = $env.NU_POWER_CONFIG.time
|
let config = $env.NU_POWER_CONFIG.time
|
||||||
let theme = $env.NU_POWER_THEME.time
|
let theme = $env.NU_POWER_THEME.time
|
||||||
let format = if $config.short {
|
let format = match $config.style {
|
||||||
$'($theme.fst)%y%m%d($theme.snd)%w($theme.fst)%H%M%S'
|
"compact" => { $'($theme.fst)%y%m%d($theme.snd)%w($theme.fst)%H%M%S' }
|
||||||
} else {
|
"rainbow" => {
|
||||||
$'($theme.fst)%y-%m-%d[%w]%H:%M:%S'
|
let fmt = [w y m d H M S]
|
||||||
|
let color = ['1;93m' '1;35m' '1;34m' '1;36m' '1;32m' '1;33m' '1;91m']
|
||||||
|
$fmt
|
||||||
|
| enumerate
|
||||||
|
| each { |x| $"(ansi -e ($color | get $x.index))%($x.item)" }
|
||||||
|
| str join
|
||||||
|
}
|
||||||
|
_ => { $'($theme.fst)%y-%m-%d[%w]%H:%M:%S' }
|
||||||
}
|
}
|
||||||
[$bg $"(date now | format date $format)"]
|
[$bg $"(date now | format date $format)"]
|
||||||
}
|
}
|
||||||
|
@ -596,7 +603,7 @@ export-env {
|
||||||
NU_POWER_CONFIG
|
NU_POWER_CONFIG
|
||||||
{
|
{
|
||||||
time: {
|
time: {
|
||||||
short: true
|
style: null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue