codeandkey/mii

Exclude specific modules from selection

Opened this issue · 2 comments

Is your feature request related to a problem? Please describe.
Some modules may not be relevant to be suggested to the user. Excluding a specific list of these modules would solve this.

For example, the top 3 modules (gentoo and nixpkgs) should be excluding:

~ $ mii search python
Results for "python": (total 16)
    MODULE           COMMAND      PARENT(S)                              RELEVANCE
    gentoo/2020      python                                              exact
    gentoo/2019      python                                              exact
    nixpkgs/16.09    python                                              exact
    python/3.9.6     python       StdEnv/2020                            exact
    python/3.8.10    python       StdEnv/2020                            exact
    python/3.8.2     python       StdEnv/2020                            exact
    python/3.7.9     python       StdEnv/2020                            exact
    python/3.7.7     python       StdEnv/2020                            exact
    python/3.6.10    python       StdEnv/2020                            exact
    python/2.7.18    python       StdEnv/2020                            exact

Idem with user selection:

~ $ python3.8
[mii] Please select a module to run python3.8:
       MODULE        PARENT(S)
    1  gentoo/2019   
    2  python/3.8.10 StdEnv/2020
    3  python/3.8.2  StdEnv/2020
    4  python/3.8.2  nixpkgs/16.09
    5  python/3.8.0  nixpkgs/16.09
Make a selection (1-5, q aborts) [1]: 

Describe the solution you'd like
Exclude some modules from a list of predefined modules. Either an environment variable or a configuration file could contain these names.

It would then results in:

~ $ python3.8
[mii] Please select a module to run python3.8:
       MODULE        PARENT(S)
    1  python/3.8.10 StdEnv/2020
    2  python/3.8.2  StdEnv/2020
    3  python/3.8.2  nixpkgs/16.09
    4  python/3.8.0  nixpkgs/16.09
Make a selection (1-5, q aborts) [1]: 

Describe alternatives you've considered
None other than filtering

Filtering with regular expression would help to filter out modules with different patterns.

For instance, pattern like name/.version or name would filter : gentoo and gentoo/.2020 (which is an hidden module).

I am having some difficulty testing this feature- the path exclusion does not seem to affect the output results. Am I using it correctly?

    $ mii -p $HOME/modules build
    [13:35:54] INFO  Finished analysis on 59 modules
    $ ./mii -p $HOME/modules search tst
    Results for "tst": (total 16)
    MODULE                             COMMAND      PARENT(S)      RELEVANCE
    ncurses-6.1-gcc-9.1.0-52pzm6j      tset                        high
    ....

All my modules are in ~/modules so I would expect all modules to be excluded. Using -i ncurses-6.1-gcc-9.1.0-52pzm6j also seems to still include the ncurses module in the results.