3 ms·
^ls -la | lines | skip 1 | split-column " " perms files group user size month day time name This is neat, but does nushell have the ability (should be trivial
by coldtea 7y ago
^ls -la | lines | skip 1 | split-column " " perms files group user size month day time name
This is neat, but does nushell have the ability (should be trivial to add) to save such a pipeline and reuse it (similar to an "alias")?
e.g.
myls = ^ls -la | lines | skip 1 | split-column " " perms files group user size month day time name
and then:
myls | where size > 1000
Also perhaps the built-in commands could be namespaced? E.g. nu.ls or nu-ls vs ls. Then you wouldn't need escaping, and the names wouldn't shadow traditional commands (but could allude to them).
- okaram 7y agoAbout namespacing, they are doing something equivalent, but making theirs the default. If they make theirs nu.ls, many (most) people would type ls ;)
- coldtea 7y ago>* If they make theirs nu.ls, many (most) people would type ls ;)* Sure, and they'll get "ls" (the standard one, from POSIX), which should be the least surprise. From then on, they'll know to call nu.ls explicitly when they need it. Sounds like a better option.
- chubot 7y agoFWIW, one of the reasons I made https://oilshell.org https://oilshell.org sh-compatible is because it already has a very elegant answer to this problem: Pipelines Support Vectorized, Point-Free, and Imperative Style http://www.oilshell.org/blog/2017/01/15.html http://www.oilshell.org/blog/2017/01/15.html You just do myls() { ls -la | lines ... ; } my ls | awk '$1 > 1000' That is, a function can be TRANSPARENTLY put in a pipeline. Shell functions have stdin and stdout that compose. The awk part isn't ideal, but I have some plans to fix that: http://www.oilshell.org/blog/tags.html?tag=awk#awk http://www.oilshell.org/blog/tags.html?tag=awk#awk https://github.com/oilshell/oil/wiki/Structured-Data-in-Oil https://github.com/oilshell/oil/wiki/Structured-Data-in-Oil