1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-07-30 13:47:46 +00:00

fix: network/sockets command (#978)

This commit is contained in:
Elizabeth 2024-10-29 11:31:52 +00:00 committed by GitHub
parent 96c7e61141
commit 58f8c75688
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
export def sockets [--abbreviate-java-class-paths (-j)] {
export def main [--abbreviate-java-class-paths (-j)] {
let input = (^lsof +c 0xFFFF -i -n -P)
let header = ($input | lines
| take 1
@ -12,7 +12,7 @@ export def sockets [--abbreviate-java-class-paths (-j)] {
| upsert 'pid' { |r| $r.pid | into int }
| rename --column { name: connection }
| reject 'command'
| join-table (ps -l) 'pid' 'pid'
| join (ps -l) 'pid' 'pid'
| if $abbreviate_java_class_paths {
upsert 'classpath' { |r| $r.command | java-cmd classpath }
| upsert 'command' { |r| $r.command | java-cmd abbreviate-classpath }
@ -26,7 +26,3 @@ export def 'java-cmd classpath' [] {
export def 'java-cmd abbreviate-classpath' [] {
str replace '[^ ]*\.jar' '*.jar'
}
export def join-table [table: table, left_on: string, right_on: string] {
dfr into df | join ($table | dfr into df) $left_on $right_on | dfr into nu
}