Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion grouping (yes, again)



On Nov 9,  5:59pm, Bart Schaefer wrote:
} Subject: Re: completion grouping (yes, again)
}
} This is great stuff, Sven.  I don't have any real opinion at this point
} about which is better.  I would suggest a couple of changes:

One other thing I forgot to mention:  I'd like it better if these functions
read from stdin/file rather than taking everything as command-line args.
Here-strings could be used for simple cases.  I wanted to do this with
_arg_compile, but didn't get around to it.

The difficulty is that the `read' builtin doesn't know from quoting, so it
isn't obvious how to come up with a representation for patterns containing
spaces (etc.) that could be unambiguously consumed without forking.

Of course, one could make two versions of each function:  One that takes
command-line args, one that takes stdin, and then do something like

    conf1_takes_stdin() {
	eval conf1_takes_args $(cat $1)
    }

but that forks off a really-should-be-unnecessary "cat".  Or

    conf1_takes_stdin() {
    	local text=conf1_takes_args line
	while read line; do text="$text $line"; done
	eval $text
    }

but that's slow and does a lot of realloc-ing.

It's just that I don't like having to write what looks like semi-structured
text with backslashes at the end of every line.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author