Compare commits
4 Commits
2a236da096
...
c3efa7d60e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3efa7d60e | ||
|
|
bc9b1b6ab2 | ||
|
|
e5db9cbf71 | ||
|
|
38dcb5cf4f |
@ -5,6 +5,7 @@ source xdg.nu
|
|||||||
|
|
||||||
use themes.nu
|
use themes.nu
|
||||||
use completions *
|
use completions *
|
||||||
|
use inspect
|
||||||
#{{- if eq .age_key "age1htqslfl4d5uv76j8eg49u9njqjx5udj9jmg3ujf2gxjjm06z0vqqwz6tlm" }}
|
#{{- if eq .age_key "age1htqslfl4d5uv76j8eg49u9njqjx5udj9jmg3ujf2gxjjm06z0vqqwz6tlm" }}
|
||||||
overlay use work
|
overlay use work
|
||||||
#{{- end }}
|
#{{- end }}
|
||||||
|
|||||||
8
dot_config/nushell/lib/inspect/gcloud.nu
Normal file
8
dot_config/nushell/lib/inspect/gcloud.nu
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export def configurations []: [
|
||||||
|
nothing -> table<record<name: string active: bool account: string zone: string region: string>>
|
||||||
|
] {
|
||||||
|
gcloud config configurations list
|
||||||
|
| detect columns
|
||||||
|
| rename name active account project zone region
|
||||||
|
| each { update active { $in == True } }
|
||||||
|
}
|
||||||
38
dot_config/nushell/lib/inspect/k8s.nu
Normal file
38
dot_config/nushell/lib/inspect/k8s.nu
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
export def namespaces [] {
|
||||||
|
# nothing -> table<record<name: string namespace: string active: string age: string>>
|
||||||
|
#] {
|
||||||
|
kubectl get namespaces | detect columns | rename name status age
|
||||||
|
}
|
||||||
|
|
||||||
|
export def services [
|
||||||
|
--namespace: string@"complete namespaces"
|
||||||
|
--service: string@"complete services"
|
||||||
|
] {
|
||||||
|
let args = [
|
||||||
|
( if $namespace != null {
|
||||||
|
[ $"--namespace=($namespace)" ]
|
||||||
|
} else {
|
||||||
|
[ $"--all-namespaces" ]
|
||||||
|
} )
|
||||||
|
] | flatten
|
||||||
|
|
||||||
|
kubectl get services ...$args -o yaml
|
||||||
|
| from yaml
|
||||||
|
| get items
|
||||||
|
| each { {
|
||||||
|
name: $in.metadata.name
|
||||||
|
namespace: $in.metadata.namespace
|
||||||
|
ports: $in.spec.ports
|
||||||
|
selector: $in.spec.selector?
|
||||||
|
} }
|
||||||
|
| where selector != null
|
||||||
|
| where name == $service or $service == null
|
||||||
|
}
|
||||||
|
|
||||||
|
export def "complete namespaces" []: nothing -> list<string> {
|
||||||
|
namespaces | get name
|
||||||
|
}
|
||||||
|
|
||||||
|
export def "complete services" []: nothing -> list<string> {
|
||||||
|
services | get name
|
||||||
|
}
|
||||||
3
dot_config/nushell/lib/inspect/mod.nu
Normal file
3
dot_config/nushell/lib/inspect/mod.nu
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export use gcloud.nu
|
||||||
|
export use k8s.nu
|
||||||
|
export use tmux.nu
|
||||||
15
dot_config/nushell/lib/inspect/tmux.nu
Normal file
15
dot_config/nushell/lib/inspect/tmux.nu
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# list of tmux sessions
|
||||||
|
export def sessions []: [
|
||||||
|
nothing -> table<record<
|
||||||
|
name: string
|
||||||
|
id: string
|
||||||
|
attached: number
|
||||||
|
windows: number
|
||||||
|
attached_list: list<string>
|
||||||
|
>>
|
||||||
|
] {
|
||||||
|
tmux list-sessions -F "#{session_name}\t#{session_id}\t#{session_windows}\t#{session_attached}\t#{session_attached_list}"
|
||||||
|
| from tsv --noheaders
|
||||||
|
| rename name id windows attached attached_list
|
||||||
|
| update attached_list { split row , }
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user