fix: replace -c ['name' 'connection'] by --column { name: connection } (#646)

The documentation states that the flag `-c`/`--column` now takes a
record as argument instead of an array:
https://www.nushell.sh/commands/docs/rename.html#flags.

I have made the change, and you can check in a nu prompt that it works
as intended:
```nu
let input = (^lsof +c 0xFFFF -i -n -P)
let header = ($input | lines
	| take 1
	| each { str downcase | str replace ' name$' ' name state' })
let body = ($input | lines
	| skip 1
	| each { str replace '([^)])$' '$1 (NONE)' | str replace ' \((.+)\)$' ' $1' })
[$header] | append $body
	| to text
	| detect columns
	| upsert 'pid' { |r| $r.pid | into int }
	| rename --column { name: connection }
```
This commit is contained in:
Antoine Sébert 2023-10-19 22:28:19 +02:00 committed by GitHub
parent ed9165fda1
commit 7b2856ddff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ export def sockets [--abbreviate-java-class-paths (-j)] {
| to text
| detect columns
| upsert 'pid' { |r| $r.pid | into int }
| rename -c ['name' 'connection']
| rename --column { name: connection }
| reject 'command'
| join-table (ps -l) 'pid' 'pid'
| if $abbreviate_java_class_paths {