diff options
Diffstat (limited to 'tprint')
-rw-r--r-- | tprint/src/Options.hs | 5 | ||||
-rw-r--r-- | tprint/src/Options/Utils.hs | 4 |
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" | |||
96 | cmdJobCreate = info cmdJobCreate' $ progDesc "Queue a new job" | 98 | cmdJobCreate = 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 | ||
101 | cmdJob = info cmdJob' $ progDesc "Retrieve a jobs contents" | 104 | cmdJob = 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 | ||
125 | cmdDraftPrint = info cmdDraftPrint' $ progDesc "Queue a copy of a drafts contents to be printed" | 128 | cmdDraftPrint = 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 | ||
128 | pOperation :: Parser Operation | 131 | pOperation :: Parser Operation |
129 | pOperation = hsubparser $ mconcat [ command "printers" cmdPrinters | 132 | pOperation = 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 | ||
10 | import Options.Applicative | 11 | import Options.Applicative |
@@ -60,3 +61,6 @@ aDraft = argument (DraftId <$> auto) (metavar "DRAFT") | |||
60 | 61 | ||
61 | pTitle :: Parser DraftTitle | 62 | pTitle :: Parser DraftTitle |
62 | pTitle = option (T.pack <$> auto) $ metavar "TITLE" <> long "title" <> short 't' | 63 | pTitle = option (T.pack <$> auto) $ metavar "TITLE" <> long "title" <> short 't' |
64 | |||
65 | pBlock :: Parser Bool | ||
66 | pBlock = switch $ long "block" <> short 'b' <> help "Do not return until job has finished printing or failed. Report errors during printing" | ||