madjar / nox

Tools to make nix nicer to use
MIT License
305 stars 35 forks source link

Unexpected behavior with numbers <1 #82

Open petersjt014 opened 6 years ago

petersjt014 commented 6 years ago

Entering numbers less than one will select and install the n+1th package in a list.

Reproduce:

> nox hier

1 aegyptus-6.00 (nixos-17.03.aegyptus) 
    Egyptian Hieroglyphs, Coptic, Meroitic 
2 anatoltan-5.02 (nixos-17.03.anatoltan) 
    Anatolian Hieroglyphs 
3 cherrytree-0.37.6 (nixos-17.03.cherrytree) 
    An hierarchical note taking application

...

31 talloc-2.1.8 (nixos.talloc) 
    Hierarchical pool based memory allocator with destructors 
32 tudu-0.10 (nixos.tudu) 
    ncurses-based hierarchical todo list manager with vim-like keybtndtngs 
33 vimplugin-vim-hier-2011-08-27 (nixos.vimPlugins.hier) 

Packages to install:

0 will install plugin 33, and -1 will install 32. I haven't tested it, but presumably multiples of n result in the same behavior.

Maybe 0 should be 'install all' and -1 'install none' (with all other negative numbers giving an error message)?