[Nix-dev] -qa '*' ?
Eelco Dolstra
eelco at cs.uu.nl
Mon Jul 23 01:49:46 CEST 2007
Hi,
Marc Weber wrote:
> '*' suggests that glob patterns or regular expressions are possible.
>
> I'd like to implement them because I'm using very often | grep ...
> Is there a regulare expression library which you would prefer beeing
> used?
>
> boost seems to have one,
> PCRE is another option..
If the boost regexp class can be easily integrated into the Nix source tree
(like the boost format class), then boost is preferable. Otherwise PCRE is
preferable, since it's more ubiquitous than Boost.
> I think there are many more.
>
> Or do you think simple glob like patterns are enogh ( *= any character
> any number of occurencies )
Indeed, maybe a full regexp library is overkill, implementing simple wildcards
should be pretty trivial so it would be best if it didn't bring in another
dependency.
> What about making the selector ('*' or name) optional defaulting to '*' ?
> nix-env already says:
> warning: you probably meant to specify the argument '*' to show all packages
>
> Is there a good reason for this implemented behaviour?
It used to be that 'nix-env -q' didn't have any arguments and just printed all
packages. Then I added support for filtering the queries based on the name, so
that changed the behaviour. The message is there as a warning.
You could argue that with no arguments it should just default to "*", but I
don't like that behaviour because it trickier to script nix-env -q. For
instance, "nix-env -q $pkgnames" would suddenly do something very different if
$pkgnames happens to empty. (Just like "cat $filenames" suddenly reads from
standard input when $filenames is empty, which is probably not intended.)
--
Eelco Dolstra | http://www.cs.uu.nl/~eelco
More information about the nix-dev
mailing list