diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-07 14:16:21 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2017-03-07 14:16:21 +0100 |
commit | 7065a8cc1b8b01cd32d4b1d5317b323fec5238bd (patch) | |
tree | d6608f463b066aa6caf33357fd9ae0e508e49084 /tprint | |
parent | 75d9fe614dca572aa1d7cfa53553e9c103eb2dd0 (diff) | |
download | thermoprint-7065a8cc1b8b01cd32d4b1d5317b323fec5238bd.tar thermoprint-7065a8cc1b8b01cd32d4b1d5317b323fec5238bd.tar.gz thermoprint-7065a8cc1b8b01cd32d4b1d5317b323fec5238bd.tar.bz2 thermoprint-7065a8cc1b8b01cd32d4b1d5317b323fec5238bd.tar.xz thermoprint-7065a8cc1b8b01cd32d4b1d5317b323fec5238bd.zip |
Bump versions
Diffstat (limited to 'tprint')
-rw-r--r-- | tprint/src/Options.hs | 24 | ||||
-rw-r--r-- | tprint/src/Options/Utils.hs | 1 | ||||
-rw-r--r-- | tprint/tprint.cabal | 8 | ||||
-rw-r--r-- | tprint/tprint.nix | 2 |
4 files changed, 23 insertions, 12 deletions
diff --git a/tprint/src/Options.hs b/tprint/src/Options.hs index e146f91..703c23b 100644 --- a/tprint/src/Options.hs +++ b/tprint/src/Options.hs | |||
@@ -26,8 +26,12 @@ import Instances () | |||
26 | import Paths_tprint (version) | 26 | import Paths_tprint (version) |
27 | import Data.Version (showVersion) | 27 | import Data.Version (showVersion) |
28 | 28 | ||
29 | import Data.Maybe | ||
30 | import Data.Monoid | ||
29 | import Data.Bifunctor (Bifunctor(..)) | 31 | import Data.Bifunctor (Bifunctor(..)) |
30 | 32 | ||
33 | import System.Environment (lookupEnv) | ||
34 | |||
31 | data TPrint = TPrint | 35 | data TPrint = TPrint |
32 | { baseUrl :: BaseUrl | 36 | { baseUrl :: BaseUrl |
33 | , dryRun :: Bool | 37 | , dryRun :: Bool |
@@ -149,12 +153,15 @@ pOperation = hsubparser $ mconcat [ command "printers" cmdPrinters | |||
149 | ) (progDesc "Interact with drafts") | 153 | ) (progDesc "Interact with drafts") |
150 | ] | 154 | ] |
151 | 155 | ||
152 | pTPrint :: Parser TPrint | 156 | pTPrint :: IO (Parser TPrint) |
153 | pTPrint = TPrint <$> option (eitherReader $ first show . parseBaseUrl) (metavar "URL" <> long "baseurl" <> short 'u' <> help "Server to interact with" <> value (BaseUrl Http "localhost" 3000 "") <> showDefaultWith showBaseUrl) | 157 | pTPrint = do |
154 | <*> switch (long "dry-run" <> short 'n' <> help "Don't send any requests that would be expected to change the servers state") | 158 | baseUrl <- parseBaseUrl =<< (fromMaybe "http://localhost:3000/" <$> lookupEnv "TPRINT_BASEURL") |
155 | <*> pOutput | 159 | return $ |
156 | <*> pOperation | 160 | TPrint <$> option (eitherReader $ first show . parseBaseUrl) (metavar "URL" <> long "baseurl" <> short 'u' <> help "Server to interact with; also read from TPRINT_BASEURL when set" <> value baseUrl <> showDefaultWith showBaseUrl) |
157 | <*> switch (long "dump-options" <> internal) | 161 | <*> switch (long "dry-run" <> short 'n' <> help "Don't send any requests that would be expected to change the servers state") |
162 | <*> pOutput | ||
163 | <*> pOperation | ||
164 | <*> switch (long "dump-options" <> internal) | ||
158 | 165 | ||
159 | pOutput :: Parser Output | 166 | pOutput :: Parser Output |
160 | pOutput = (,) <$> pOutputFormat <*> pSink | 167 | pOutput = (,) <$> pOutputFormat <*> pSink |
@@ -177,4 +184,7 @@ pInput = (,) <$> pInputFormat <*> pSource | |||
177 | rSource' x = ReadFile x | 184 | rSource' x = ReadFile x |
178 | 185 | ||
179 | withArgs :: (TPrint -> IO a) -> IO a | 186 | withArgs :: (TPrint -> IO a) -> IO a |
180 | withArgs a = customExecParser (prefs $ showHelpOnError) (info pTPrint $ header ("tprint " ++ showVersion version) <> progDesc "A cli for Thermoprint.Client") >>= a | 187 | withArgs a = do |
188 | pTPrint' <- pTPrint | ||
189 | customExecParser (prefs $ showHelpOnError) (info pTPrint' $ header ("tprint " ++ showVersion version) <> progDesc "A cli for Thermoprint.Client") >>= a | ||
190 | |||
diff --git a/tprint/src/Options/Utils.hs b/tprint/src/Options/Utils.hs index 237aa56..3fae250 100644 --- a/tprint/src/Options/Utils.hs +++ b/tprint/src/Options/Utils.hs | |||
@@ -13,6 +13,7 @@ import Options.Applicative | |||
13 | import Data.Text (Text) | 13 | import Data.Text (Text) |
14 | import qualified Data.Text as T (pack) | 14 | import qualified Data.Text as T (pack) |
15 | 15 | ||
16 | import Data.Monoid | ||
16 | import Data.Char | 17 | import Data.Char |
17 | import Data.Maybe | 18 | import Data.Maybe |
18 | import Data.List | 19 | import Data.List |
diff --git a/tprint/tprint.cabal b/tprint/tprint.cabal index 5fcd00b..94b0a8a 100644 --- a/tprint/tprint.cabal +++ b/tprint/tprint.cabal | |||
@@ -2,7 +2,7 @@ | |||
2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
3 | 3 | ||
4 | name: tprint | 4 | name: tprint |
5 | version: 2.0.0 | 5 | version: 3.0.0 |
6 | synopsis: A CLI for thermoprint-client | 6 | synopsis: A CLI for thermoprint-client |
7 | -- description: | 7 | -- description: |
8 | homepage: http://dirty-haskell.org/tags/thermoprint.html | 8 | homepage: http://dirty-haskell.org/tags/thermoprint.html |
@@ -23,15 +23,15 @@ executable tprint | |||
23 | , Instances | 23 | , Instances |
24 | -- other-extensions: | 24 | -- other-extensions: |
25 | build-depends: base >=4.8 && <5 | 25 | build-depends: base >=4.8 && <5 |
26 | , thermoprint-bbcode >=2.0.0 && <3 | 26 | , thermoprint-bbcode >=3.0.0 && <4 |
27 | , thermoprint-client ==1.0.* | 27 | , thermoprint-client ==2.0.* |
28 | , optparse-applicative >=0.12.1 && <1 | 28 | , optparse-applicative >=0.12.1 && <1 |
29 | , containers >=0.5.6 && <1 | 29 | , containers >=0.5.6 && <1 |
30 | , time >=1.5.0 && <2 | 30 | , time >=1.5.0 && <2 |
31 | , pretty-show >=1.6.9 && <2 | 31 | , pretty-show >=1.6.9 && <2 |
32 | , text >=1.2.2 && <2 | 32 | , text >=1.2.2 && <2 |
33 | , aeson-pretty >=0.7.2 && <1 | 33 | , aeson-pretty >=0.7.2 && <1 |
34 | , aeson >=0.9.0 && <1 | 34 | , aeson >=1.0 && <2 |
35 | , bytestring >=0.10.6 && <1 | 35 | , bytestring >=0.10.6 && <1 |
36 | , exceptions >=0.8.2 && <1 | 36 | , exceptions >=0.8.2 && <1 |
37 | , deepseq >=1.4.1 && <2 | 37 | , deepseq >=1.4.1 && <2 |
diff --git a/tprint/tprint.nix b/tprint/tprint.nix index 946a4ce..9ce247d 100644 --- a/tprint/tprint.nix +++ b/tprint/tprint.nix | |||
@@ -4,7 +4,7 @@ | |||
4 | }: | 4 | }: |
5 | mkDerivation { | 5 | mkDerivation { |
6 | pname = "tprint"; | 6 | pname = "tprint"; |
7 | version = "2.0.0"; | 7 | version = "3.0.0"; |
8 | src = ./.; | 8 | src = ./.; |
9 | isLibrary = false; | 9 | isLibrary = false; |
10 | isExecutable = true; | 10 | isExecutable = true; |