Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4267 Add --exact flag to the list command #6618

Closed
wants to merge 1 commit into from

Conversation

v0d1ch
Copy link
Contributor

@v0d1ch v0d1ch commented Mar 27, 2020

fixes #4267

This PR adds --exact flag to the cabal list command which
enables exact match on the package name while searching.

The cabal list output looks like this for mtl package:

cabal list mtl

* AbortT-mtl
    Synopsis: mtl instances for the AbortT monad transformer
    Default available version: 1.0.0.1
    Installed versions: [ Not installed ]
    Homepage: http://github.com/gcross/AbortT-mtl
    License:  BSD3

* Hsmtlib
    Synopsis: Haskell library for easy interaction with SMT-LIB 2 compliant
              solvers.
    Default available version: 2.8.8.8
    Installed versions: [ Not installed ]
    Homepage: https://github.com/MfesGA/Hsmtlib
    License:  BSD3

* MonadCatchIO-mtl
    Synopsis: Monad-transformer version of the Control.Exception module
    Default available version: 0.3.1.0
    Installed versions: [ Not installed ]
    Homepage: http://darcsden.com/jcpetruzza/MonadCatchIO-mtl
    License:  BSD3
...

And when using the --exact flag we are matching the exact package name like this:

cabal list mtl --exact
* mtl
    Synopsis: Monad classes, using functional dependencies
    Default available version: 2.2.2
    Installed versions: 2.2.2
    Homepage: http://github.com/haskell/mtl
    License:  BSD3

cabal-testsuite/Test/Cabal/Monad.hs Outdated Show resolved Hide resolved
Cabal/Distribution/Simple/Program/HcPkg.hs Outdated Show resolved Hide resolved
cabal-install/Distribution/Client/List.hs Outdated Show resolved Hide resolved
cabal-install/Distribution/Client/List.hs Outdated Show resolved Hide resolved
@v0d1ch v0d1ch force-pushed the 4267-cabal-list-exact-option branch from a47b0e3 to b6cdb56 Compare March 27, 2020 10:44
@v0d1ch
Copy link
Contributor Author

v0d1ch commented Mar 27, 2020

Pinging Dr. @phadej again

@v0d1ch v0d1ch force-pushed the 4267-cabal-list-exact-option branch from b6cdb56 to 1bf4be6 Compare April 6, 2020 19:39
@v0d1ch v0d1ch requested a review from phadej April 6, 2020 19:39
@@ -1,6 +1,9 @@
-*-change-log-*-

3.2.0.0 Herbert Valerio Riedel <[email protected]> April 2020
3.2.0.0 Someone <mailto:[email protected]> February 2020
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add fine to changelog.d directory, see the issue-* files for an examples

It's recent change, so we won't introduce conflicts to changelog files.

@@ -164,7 +164,7 @@ hackageBenchmarkMain = do
if null argPackages
then do
putStrLn $ "Obtaining the package list (using " ++ argCabal1 ++ ") ..."
list <- readProcess argCabal1 ["list", "--simple-output"] ""
list <- readProcess argCabal1 ["list", "--simple-output", "--exact"] ""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to be related to the reported issue. Why this change? Does exact makes it somehow faster?

[ pkgs
| pkgs@(pname, _) <- Map.toList m
, lsearchterm `isInfixOf` lowercase (unPackageName pname) ]
, if exactMatch
then searchterm `isInfixOf` unPackageName pname
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why still isInfixOf ?

This PR adds `--exact` flag to the cabal list command which
enables exact match on the package name while searching.
@v0d1ch v0d1ch force-pushed the 4267-cabal-list-exact-option branch from 1bf4be6 to 3d44fef Compare April 7, 2020 14:37
@v0d1ch v0d1ch requested a review from phadej April 7, 2020 14:45
@phadej phadej self-assigned this Apr 9, 2020
@phadej
Copy link
Collaborator

phadej commented Apr 9, 2020

Merged in #6681. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

better for cabal list to default to exact match or have an --exact option
2 participants