cli-arguments 0.3.1.0 → 0.4.0.0
raw patch · 4 files changed
+79/−4 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ CLI.Arguments: getA :: Foldable t => String -> t Arguments -> String
+ CLI.Arguments: getB :: Foldable t => String -> t Arguments -> [String]
+ CLI.Arguments: getC :: Foldable t => String -> t Arguments -> [String]
+ CLI.Arguments: getLstA :: Foldable t => [String] -> t Arguments -> [String]
+ CLI.Arguments: getLstB :: Foldable t => [String] -> t Arguments -> [[String]]
+ CLI.Arguments: getLstC :: Foldable t => [String] -> t Arguments -> [[String]]
+ CLI.Arguments: listA :: Foldable t => [String] -> t Arguments -> Bool
+ CLI.Arguments: listB :: Foldable t => [String] -> t Arguments -> Bool
+ CLI.Arguments: listC :: Foldable t => [String] -> t Arguments -> Bool
+ CLI.Arguments: oneA :: Foldable t => String -> t Arguments -> Bool
+ CLI.Arguments: oneB :: Foldable t => String -> t Arguments -> Bool
+ CLI.Arguments: oneC :: Foldable t => String -> t Arguments -> Bool
Files
- CHANGELOG.md +4/−0
- CLI/Arguments.hs +72/−1
- LICENSE +1/−1
- cli-arguments.cabal +2/−2
CHANGELOG.md view
@@ -23,3 +23,7 @@ * Third version revised A. Added some more general functions to process arrays, type synonyms to improve code readability, reduced code duplication. +## 0.4.0.0 -- 2022-01-10++* Fourth version. Added new functions. Changed the dependency boundaries.+
CLI/Arguments.hs view
@@ -2,7 +2,7 @@ -- | -- Module : CLI.Arguments--- Copyright : (c) OleksandrZhabenko 2021+-- Copyright : (c) OleksandrZhabenko 2021-2022 -- License : MIT -- Stability : Experimental -- Maintainer : olexandr543@yahoo.com@@ -12,8 +12,10 @@ module CLI.Arguments where import Data.Monoid (mappend)+import Data.Maybe (fromJust) import GHC.Arr import Data.List (sortBy)+import qualified Data.Foldable as F data Arguments = A String@@ -376,3 +378,72 @@ -> Array Int Arguments takeAsArrSortedBy = takeABCsArrSortedBy (takeArgsSortedBy (\x -> notNullArguments x && isA x)) {-# INLINABLE takeAsArrSortedBy #-}++-------------------------------------------------------------------------------++oneA+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneA xs ys = F.any (\(A ts) -> ts == xs) ys++oneB+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneB xs ys = F.any (\(B _ zs _) -> zs == xs) ys++oneC+ :: (F.Foldable t) => String -> t Arguments -> Bool+oneC xs ys = F.any (\(C zs _) -> zs == xs) ys++listA+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listA xss ys+ | null xss = False+ | otherwise = F.any (\(A ts) -> ts `elem` xss) ys++listB+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listB xss ys+ | null xss = False+ | otherwise = F.any (\(B _ zs _) -> zs `elem` xss) ys++listC+ :: (F.Foldable t) => [String] -> t Arguments -> Bool+listC xss ys+ | null xss = False+ | otherwise = F.any (\(C zs _) -> zs `elem` xss) ys++getA+ :: (F.Foldable t) => String -> t Arguments -> String+getA xs ys+ | oneA xs ys = (\(A ts) -> ts) . fromJust . F.find (\(A rs) -> rs == xs) $ ys+ | otherwise = []++getB+ :: (F.Foldable t) => String -> t Arguments -> [String]+getB xs ys+ | oneB xs ys = (\(B _ _ yss) -> yss) . fromJust . F.find (\(B _ zs _) -> zs == xs) $ ys+ | otherwise = []++getC+ :: (F.Foldable t) => String -> t Arguments -> [String]+getC xs ys+ | oneC xs ys = (\(C _ yss) -> yss) . fromJust . F.find (\(C zs _) -> zs == xs) $ ys+ | otherwise = []++getLstA+ :: (F.Foldable t) => [String] -> t Arguments -> [String]+getLstA xss ys+ | listA xss ys = filter (not . null) . map (\xs -> getA xs ys) $ xss+ | otherwise = []++getLstB+ :: (F.Foldable t) => [String] -> t Arguments -> [[String]]+getLstB xss ys+ | listB xss ys = filter (not . null) . map (\xs -> getB xs ys) $ xss+ | otherwise = []++getLstC+ :: (F.Foldable t) => [String] -> t Arguments -> [[String]]+getLstC xss ys+ | listC xss ys = filter (not . null) . map (\xs -> getC xs ys) $ xss+ | otherwise = []+
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2021 OleksandrZhabenko+Copyright (c) 2021-2022 OleksandrZhabenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
cli-arguments.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/ name: cli-arguments-version: 0.3.1.0+version: 0.4.0.0 synopsis: A library to process command line arguments in some more convenient way. description: Uses three types of the command line arguments and order of their parsing. Usually firstly the framed by some string delimiter (the different ones) are parsed, then the groups of arguments and then the rest single-field arguments. All these groups must be not nested one into the others. -- bug-reports:@@ -21,6 +21,6 @@ exposed-modules: CLI.Arguments -- other-modules: -- other-extensions:- build-depends: base >=4.7 && <5+ build-depends: base >=4.8 && <5 -- hs-source-dirs: default-language: Haskell2010