mirror of
https://github.com/nushell/nu_scripts.git
synced 2024-08-17 01:10:36 +03:00
move cache into $nu.data-dir/cache
This commit is contained in:
parent
4db7930605
commit
4608fc3bf0
@ -79,7 +79,7 @@ export def 'cwd history delete' [cwd] {
|
||||
|
||||
export-env {
|
||||
$env.cwd_history_full = false
|
||||
$env.cwd_history_file = $'($env.HOME)/.cache/nu_cwd_history.sqlite'
|
||||
$env.cwd_history_file = ([$nu.data-dir 'cache'] | path join 'nu_cwd_history.sqlite')
|
||||
|
||||
if not ($env.cwd_history_file | path exists) {
|
||||
empty-sqlite | save -f $env.cwd_history_file
|
||||
|
@ -1,5 +1,5 @@
|
||||
export-env {
|
||||
for c in [nerdctl podman docker] {
|
||||
for c in [podman nerdctl docker] {
|
||||
if (which $c | is-not-empty) {
|
||||
$env.docker-cli = $c
|
||||
break
|
||||
|
@ -3,7 +3,7 @@ use utils.nu *
|
||||
|
||||
export def "nu-complete kube ctx" [] {
|
||||
let k = (kube-config)
|
||||
let cache = $'($env.HOME)/.cache/nu-complete/k8s/($k.path | path basename).json'
|
||||
let cache = ([$nu.data-dir 'cache' 'k8s'] | path join $'($k.path | path basename).json')
|
||||
let data = ensure-cache-by-lines $cache $k.path { ||
|
||||
let clusters = $k.data | get clusters | select name cluster.server
|
||||
let data = $k.data
|
||||
@ -38,7 +38,7 @@ export def "nu-complete kube ns" [] {
|
||||
|
||||
export def "nu-complete kube kind" [] {
|
||||
let ctx = (kube-config)
|
||||
let cache = $'($env.HOME)/.cache/nu-complete/k8s-api-resources/($ctx.data.current-context).json'
|
||||
let cache = ([$nu.data-dir 'cache' 'k8s-api-resources'] | path join $'($ctx.data.current-context).json')
|
||||
ensure-cache-by-lines $cache $ctx.path {||
|
||||
kubectl api-resources | from ssv -a
|
||||
| each {|x| {value: $x.NAME description: $x.SHORTNAMES} }
|
||||
|
@ -266,7 +266,7 @@ export def --wrapped ka [
|
||||
let n = $namespace | with-flag -n
|
||||
let pod = if ($selector | is-empty) {
|
||||
if ($pod | str ends-with '-') {
|
||||
$"deployment/($pod | str substring ..<-1)"
|
||||
$"deployment/($pod | str trim --char '-' --right)"
|
||||
} else {
|
||||
$pod
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ def "kube ctx" [] {
|
||||
mut cache = ''
|
||||
mut file = ''
|
||||
if ($env.KUBECONFIG? | is-empty) {
|
||||
$cache = $'($env.HOME)/.cache/nu-power/kube.json'
|
||||
$cache = ([$nu.data-dir 'cache' 'power'] | path join 'kube.json')
|
||||
$file = $"($env.HOME)/.kube/config"
|
||||
} else {
|
||||
$cache = $"($env.HOME)/.cache/nu-power/kube-($env.KUBECONFIG | str replace -a '/' ':').json"
|
||||
$cache = ([$nu.data-dir 'cache' 'power'] | path join $"kube-($env.KUBECONFIG | str replace -a '/' ':').json")
|
||||
$file = $env.KUBECONFIG
|
||||
}
|
||||
if not ($file | path exists) { return null }
|
||||
|
@ -57,7 +57,7 @@ def fmt-group [p] {
|
||||
}
|
||||
|
||||
def "ssh-hosts" [] {
|
||||
let cache = $'($env.HOME)/.cache/nu-complete/ssh.json'
|
||||
let cache = ([$nu.data-dir 'cache'] | path join 'ssh.json')
|
||||
ensure-cache $cache [~/.ssh/config ~/.ssh/config*/* ] { ||
|
||||
let data = (ssh-list | each {|x|
|
||||
let uri = $"($x.User)@($x.HostName):($x.Port)"
|
||||
|
Loading…
Reference in New Issue
Block a user