aboutsummaryrefslogtreecommitdiff
path: root/tprint
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2016-03-01 10:41:08 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2016-03-01 10:41:08 +0100
commit8d811536eb1b45e2be3eb6be1e2f1a3feef04336 (patch)
tree8b41df226a7c2dd56d7d82fcfebf1a0f512b5179 /tprint
parent11ed93f1d94aa3bffa7a660128ac802743024a02 (diff)
downloadthermoprint-8d811536eb1b45e2be3eb6be1e2f1a3feef04336.tar
thermoprint-8d811536eb1b45e2be3eb6be1e2f1a3feef04336.tar.gz
thermoprint-8d811536eb1b45e2be3eb6be1e2f1a3feef04336.tar.bz2
thermoprint-8d811536eb1b45e2be3eb6be1e2f1a3feef04336.tar.xz
thermoprint-8d811536eb1b45e2be3eb6be1e2f1a3feef04336.zip
Option to block and wait for job to be printed
Diffstat (limited to 'tprint')
-rw-r--r--tprint/src/Options.hs5
-rw-r--r--tprint/src/Options/Utils.hs4
2 files changed, 8 insertions, 1 deletions
diff --git a/tprint/src/Options.hs b/tprint/src/Options.hs
index 30350cb..ca5ee2b 100644
--- a/tprint/src/Options.hs
+++ b/tprint/src/Options.hs
@@ -44,6 +44,7 @@ data Operation
44 } 44 }
45 | JobCreate 45 | JobCreate
46 { printer :: Maybe PrinterId 46 { printer :: Maybe PrinterId
47 , block :: Bool
47 , input :: Input 48 , input :: Input
48 } 49 }
49 | Job { jobId :: JobId } 50 | Job { jobId :: JobId }
@@ -63,6 +64,7 @@ data Operation
63 | DraftDelete { draftId :: DraftId } 64 | DraftDelete { draftId :: DraftId }
64 | DraftPrint 65 | DraftPrint
65 { draftId :: DraftId 66 { draftId :: DraftId
67 , block :: Bool
66 , printer :: Maybe PrinterId 68 , printer :: Maybe PrinterId
67 } 69 }
68 deriving (Show, Generic, PrettyVal) 70 deriving (Show, Generic, PrettyVal)
@@ -96,6 +98,7 @@ cmdJobs = info cmdJobs' $ progDesc "List printjobs"
96cmdJobCreate = info cmdJobCreate' $ progDesc "Queue a new job" 98cmdJobCreate = info cmdJobCreate' $ progDesc "Queue a new job"
97 where cmdJobCreate' = JobCreate 99 where cmdJobCreate' = JobCreate
98 <$> optional (pPrinter $ help "Direct for the job to printed on #PRINTER specifically") 100 <$> optional (pPrinter $ help "Direct for the job to printed on #PRINTER specifically")
101 <*> pBlock
99 <*> pInput 102 <*> pInput
100 103
101cmdJob = info cmdJob' $ progDesc "Retrieve a jobs contents" 104cmdJob = info cmdJob' $ progDesc "Retrieve a jobs contents"
@@ -123,7 +126,7 @@ cmdDraftDelete = info cmdDraftDelete' $ progDesc "Delete a draft"
123 where cmdDraftDelete' = DraftDelete <$> aDraft 126 where cmdDraftDelete' = DraftDelete <$> aDraft
124 127
125cmdDraftPrint = info cmdDraftPrint' $ progDesc "Queue a copy of a drafts contents to be printed" 128cmdDraftPrint = info cmdDraftPrint' $ progDesc "Queue a copy of a drafts contents to be printed"
126 where cmdDraftPrint' = DraftPrint <$> aDraft <*> optional (pPrinter $ help "Direct for the drafts contents to be printed on #PRINTER specifically") 129 where cmdDraftPrint' = DraftPrint <$> aDraft <*> pBlock <*> optional (pPrinter $ help "Direct for the drafts contents to be printed on #PRINTER specifically")
127 130
128pOperation :: Parser Operation 131pOperation :: Parser Operation
129pOperation = hsubparser $ mconcat [ command "printers" cmdPrinters 132pOperation = hsubparser $ mconcat [ command "printers" cmdPrinters
diff --git a/tprint/src/Options/Utils.hs b/tprint/src/Options/Utils.hs
index b3561e9..237aa56 100644
--- a/tprint/src/Options/Utils.hs
+++ b/tprint/src/Options/Utils.hs
@@ -5,6 +5,7 @@ module Options.Utils
5 , pPrinter 5 , pPrinter
6 , aDraft 6 , aDraft
7 , pTitle 7 , pTitle
8 , pBlock
8 ) where 9 ) where
9 10
10import Options.Applicative 11import Options.Applicative
@@ -60,3 +61,6 @@ aDraft = argument (DraftId <$> auto) (metavar "DRAFT")
60 61
61pTitle :: Parser DraftTitle 62pTitle :: Parser DraftTitle
62pTitle = option (T.pack <$> auto) $ metavar "TITLE" <> long "title" <> short 't' 63pTitle = option (T.pack <$> auto) $ metavar "TITLE" <> long "title" <> short 't'
64
65pBlock :: Parser Bool
66pBlock = switch $ long "block" <> short 'b' <> help "Do not return until job has finished printing or failed. Report errors during printing"