Re:One Year of Nushell
by forbes on Tuesday August 25, 2020 @12:48AM
(#24268194)
This seems very interesting. After a quick play I cannot find anything similar to 'less' which I use very frequently. Is there a nushell equivalent?
[ Parent
| on HN ]
The equivalent is called `textview` which is a built-in which tries to be a bit more intelligent than `less` with regard to file-types.
The default viewer, which sort of runs at the end of every pipeline is called `autoview`.
Now.. autoview should be calling textview in the cases where the pipeline detects a large text value. It is possible that you're not exactly running a pipeline.
For instance: If you run:
cat big.log
it is not running a pipeline, just an external command.If you run:
open big.log
you're invoking nushell's mechanism for creating a pipeline sourced by the contents of big.log. You should also notice that textview is invoked, because there should be a pager.
Alternatively, you can choose to create a pipeline by pipe-ing the output of cat big.log into something.
If you pipe it to textview you should see the same result: cat big.log | textview
Hope that helps!The command that I was trying to use was 'ls', which doesn't seem to play with textview when I try it out 'ls | textview' (just no output at all). textview does work for me with files, as in your example.
less is a program, why can’t you use it from nu?
If you use less with a filename, it will work. I normally pipe things to less which doesn't seem to work for me in nu. less shows an empty input.
This is possibly me just doing something wrong.
`cat notes.txt | less` works fine for me in nu 0.18.1