pipelines, strings and renderers

4 views
Skip to first unread message

Hamish

unread,
Jun 27, 2008, 1:03:24 PM6/27/08
to Hotwire Shell
I'm working on a uniq builtin - it would only allow unique objects/
properties through, and could count them with a flag. I'm running
into a few issues and probably need to dive into some internals to fix
it.

First up is multiple short strings going through the system and ending
up in the UnicodeRenderer. Why can't we have the UnicodeRenderer
append a new line to strings that don't have one? This is generally
going to be the intention I imagine ... Look at the following 2
pipelines

fsearch xyz | uniq path
fsearch xyz | uniq path | ls -i

Currently the first produces a load of stuff on one line. The second
works as I expect. But if I modify uniq to append newlines then ls -i
fails to find the path.

I do know about the newline builtin, but it seems to be far more
logical to just add a new line in the unicode renderer. Is there any
use case where we wouldn't want the unicode renderer to append a new
line? If I don't hear of a reason, I'll start an issue and post a
patch.

And as a side issue, I thought I might modify the FilePath class to
automatically strip trailing new lines in the __new__() method. (I
guess there are cases where there is leading or trailing whitespace in
a filename, even if only by accident, but I can't imagine a newline
being part of a filename. Is it ever legal to do that?
Reply all
Reply to author
Forward
0 new messages