packages feed

casa-abbreviations-and-acronyms 0.0.2 → 0.0.3

raw patch · 3 files changed

+34/−10 lines, 3 filesdep ~bytestringdep ~thesedep ~wreq

Dependency ranges changed: bytestring, these, wreq

Files

casa-abbreviations-and-acronyms.cabal view
@@ -1,7 +1,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                  casa-abbreviations-and-acronyms-version:               0.0.2+version:               0.0.3 synopsis:              CASA Abbreviations and Acronyms description:          <<http://i.imgur.com/uZnp9ke.png>>@@ -40,9 +40,9 @@                        , containers        >= 0.5     && < 0.6                        , fuzzy             >= 0.1.0.0 && < 0.2                        , monoid-subclasses >= 0.4     && < 0.5-                       , wreq-                       , bytestring-                       , these+                       , wreq              >= 0.5     && < 0.6+                       , bytestring        >= 0.10    && < 0.11+                       , these             >= 0.7     && < 0.8    hs-source-dirs:      src/library 
changelog.md view
@@ -1,3 +1,8 @@+0.0.3++* Add -x|--max-results option.+* Add version number to header.+ 0.0.2  * Use nix.
src/executable/Main.hs view
@@ -21,7 +21,7 @@ import Data.Function(($)) import Data.Functor((<$>), fmap) import Data.Int(Int)-import Data.List(filter)+import Data.List(filter, take) import Data.Maybe(Maybe(Just, Nothing), maybe, maybeToList) import Data.Monoid(Monoid(mempty)) import Data.Ord(Ord((>=), (>)), max, min)@@ -41,12 +41,12 @@         execParser           (info ((parserOptions :: Parser (Options [] ShowAcronym)) <**> helper) (             fullDesc <>-            header "casa-abbreviations-and-acronyms for searching CASA abbreviations and acronyms <https://www.casa.gov.au/about-us/standard-page/aviation-abbreviations-and-acronyms>"+            header "casa-abbreviations-and-acronyms for searching CASA abbreviations and acronyms 0.0.3 <https://www.casa.gov.au/about-us/standard-page/aviation-abbreviations-and-acronyms>"           )         )   in  do  opts <- execopts           case opts of-            Options clrs rndr (MatchField fz ex) typ (FieldSpacing mn xn mm xm ms xs mr xr) term ->+            Options clrs rndr maxr (MatchField fz ex) typ (FieldSpacing mn xn mm xm ms xs mr xr) term ->               let acro =                     let match =                           case typ of@@ -70,10 +70,12 @@                       , (sourceSpacing, ms, xs)                       , (scoreSpacing, mr, xr)                       ]+                  acro' =+                    maybe id take maxr acro                   out =                     runConfig-                      (rndr acro)-                      (space $ Config clrs (exactWidthSpacing acro))+                      (rndr acro')+                      (space $ Config clrs (exactWidthSpacing acro'))               in  putStrLn out  data ShowAcronym =@@ -237,11 +239,12 @@   Options     Colours -- no colours     (t a -> ConfigReader String) -- no header+    (Maybe Int) -- maximum results     MatchField     MatchType     FieldSpacing     String -- the search term-  + parserOptions ::   (HasShowScore a, HasAcronym a, Traversable t) =>   Parser (Options t a)@@ -266,6 +269,22 @@           help "turn off the header in the output"         )     )+    <*>+    option+      (+        maybeReader+          (\s -> case reads s of+                    (n, _):_ ->+                      Just (Just n)+                    [] ->+                      Nothing)+      )+      (+        short 'x' <>+        long "max-results" <>+        value Nothing <>+        help "maximum number of results"+      )     <*>     parserMatchField     <*>