by hnlmorg · 3y ago · 0 comments
I don't have Windows to test Windows `netcat` on but the Murex code would look something like this:
netstat -ao -p tcp -b | [Proto..]r | tabulate --separator " +" | [Proto "Local Address" "Foreign Address" State PID]
# [Proto..]r -> select every line after the regexp expression "Proto"
# tabulate --separator " +" -> by default columns are split on whitespace. But here we are saying use two or more spaces
# [Proto "Local Address" "Foreign Address" State PID] -> selects columns (we already have column titles from `netstat` so why reinvent the wheel?)
Likewise with your `podman` examples, in murex this would look like: function podman {
cast json
exec podman --output=json @PARAMS
}
You can even configure Murex REPL to only autocomplete commands that support JSON input from `podman`: method define podman %{ Stdout: json }
...so now when you type `podman | <tab>` you only see commands that are compatible with JSON.I do have a lot of respect for Nushell but I've been using Murex as my primary shell for longer than Nushell has been around so a lot of these edge cases have been solved in Murex too. I just don't do a particularly great job at advertising it :)