optparse-generic 1.5.1 → 1.5.2
raw patch · 3 files changed
+32/−2 lines, 3 filesdep +filepathdep ~bytestringdep ~optparse-applicativedep ~text
Dependencies added: filepath
Dependency ranges changed: bytestring, optparse-applicative, text, time
Files
- CHANGELOG.md +4/−0
- optparse-generic.cabal +3/−2
- src/Options/Generic.hs +25/−0
CHANGELOG.md view
@@ -1,3 +1,7 @@+1.5.2++* [Add support for `OsPath`](https://github.com/Gabriella439/optparse-generic/pull/111)+ 1.5.1 * [Add `Eq` instances for `(<?>)`, `(<!>)`, and `(<#>)`](https://github.com/Gabriella439/optparse-generic/pull/109)
optparse-generic.cabal view
@@ -1,5 +1,5 @@ Name: optparse-generic-Version: 1.5.1+Version: 1.5.2 Cabal-Version: >=1.10 Build-Type: Simple License: BSD3@@ -32,7 +32,8 @@ optparse-applicative >= 0.16.0.0 && < 0.19, time >= 1.5 && < 1.13, void < 0.8 ,- bytestring < 0.12+ bytestring < 0.12,+ filepath < 1.5 if impl(ghc < 8.0) Build-Depends:
src/Options/Generic.hs view
@@ -384,6 +384,10 @@ import Numeric.Natural (Natural) #endif +#if MIN_VERSION_filepath(1,4,100)+import System.OsPath+#endif+ auto :: Read a => ReadM a auto = do s <- Options.readerAsk@@ -602,6 +606,18 @@ readField = readISO8601Field +#if MIN_VERSION_filepath(1,4,100)+instance ParseField OsString where+ metavar _ = "PATH"+ readField = Options.eitherReader reader+ where+ reader string =+ case encodeUtf string of+ Left err -> Left ("Invalid PATH: " ++ show err)+ Right t -> pure t++#endif+ {-| A class for all types that can be parsed from zero or more arguments/options on the command line @@ -651,6 +667,10 @@ instance ParseFields LocalTime instance ParseFields ZonedTime +#if MIN_VERSION_filepath(1,4,100)+instance ParseFields OsString+#endif+ #if MIN_VERSION_base(4,8,0) instance ParseFields Natural #endif@@ -881,6 +901,11 @@ instance ParseRecord ZonedTime where parseRecord = fmap getOnly parseRecord++#if MIN_VERSION_filepath(1,4,100)+instance ParseRecord OsString where+ parseRecord = fmap getOnly parseRecord+#endif instance ParseField a => ParseRecord (Maybe a) where parseRecord = fmap getOnly parseRecord