network-uri-template 0.1.0.0 → 0.1.1.0
raw patch · 5 files changed
+26/−5 lines, 5 files
Files
- CHANGELOG.md +1/−1
- README.lhs +4/−0
- README.md +4/−0
- app/Main.hs +16/−3
- network-uri-template.cabal +1/−1
CHANGELOG.md view
@@ -1,1 +1,1 @@-See https://codeberg.org/pbrisbin/mdoc/releases+See https://codeberg.org/pbrisbin/network-uri-template/releases
README.lhs view
@@ -1,5 +1,9 @@ # network-uri-template +[](https://hackage.haskell.org/package/network-uri-template)+[](http://stackage.org/nightly/package/network-uri-template)+[](http://stackage.org/lts/package/network-uri-template)+ Library for parsing and expanding URI Templates, as per [RFC 6570][rfc6570]. [rfc6570]: https://datatracker.ietf.org/doc/html/rfc6570
README.md view
@@ -1,5 +1,9 @@ # network-uri-template +[](https://hackage.haskell.org/package/network-uri-template)+[](http://stackage.org/nightly/package/network-uri-template)+[](http://stackage.org/lts/package/network-uri-template)+ Library for parsing and expanding URI Templates, as per [RFC 6570][rfc6570]. [rfc6570]: https://datatracker.ietf.org/doc/html/rfc6570
app/Main.hs view
@@ -31,6 +31,7 @@ data Options = Options { variables :: Map VarName VarValue+ , noPretty :: Bool , template :: Template } @@ -62,6 +63,12 @@ , metavar "ARG" ] )+ <*> switch+ ( mconcat+ [ long "no-pretty"+ , help "Only output the resulting expansion and single newline"+ ]+ ) <*> argument (eitherReader $ parseOpt templateP) ( mconcat@@ -74,6 +81,14 @@ main = do opts <- parseOptions + let expanded = expandTemplate opts.variables opts.template++ if opts.noPretty+ then T.putStrLn expanded+ else prettyPrint opts expanded++prettyPrint :: Options -> Text -> IO ()+prettyPrint opts expanded = do tty <- hIsTerminalDevice stdout let@@ -102,9 +117,7 @@ $ reAnnotate AnnTemplate $ templatePretty opts.template , ""- , sectionPretty "Expanded"- $ pretty- $ expandTemplate opts.variables opts.template+ , sectionPretty "Expanded" $ pretty expanded ] sectionPretty :: Text -> Doc Ann -> Doc Ann
network-uri-template.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: network-uri-template-version: 0.1.0.0+version: 0.1.1.0 license: AGPL-3 maintainer: Pat Brisbin synopsis: TODO