Skip to content

Commit

Permalink
add missing optparse-applicative parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljklein committed Dec 5, 2019
1 parent 78ba04a commit 7e6c10b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
14 changes: 0 additions & 14 deletions app/LorentzContractsOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,6 @@ argParser = Opt.subparser $ mconcat
, Opt.help "File to use as input."
]

printOptions = Opt.strOption $ mconcat
[ Opt.short 'n'
, Opt.long "name"
, Opt.metavar "IDENTIFIER"
, Opt.help "Name of a contract returned by `list` command."
]

outputOptions = optional . Opt.strOption $ mconcat
[ Opt.short 'o'
, Opt.long "output"
, Opt.metavar "FILEPATH"
, Opt.help "File to use as output. If not specified, stdout is used."
]

baseContractOptions = optional . Opt.strOption $ mconcat
[ Opt.short 'i'
, Opt.long "input-contract"
Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<<: *meta
name: lorentz-contract-param
version: 1.2.2.0.0
version: 1.2.2.1.0
synopsis: Set of Michelson contracts implemented in Lorentz eDSL, with CLI interface
description:
Various contracts including simple examples.
Expand Down
18 changes: 18 additions & 0 deletions src/Lorentz/Contracts/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,21 @@ parseSomePublicKey =
(G.SomePublicKey (Proxy @(PublicKey, PublicKey)) <$>
(Opt.eitherReader (eitherDecode . fromString) <|> Opt.auto :: Opt.ReadM (PublicKey, PublicKey)))

-- | Parse which contract to print
printOptions :: Opt.Parser Text
printOptions = Opt.strOption $ mconcat
[ Opt.short 'n'
, Opt.long "name"
, Opt.metavar "IDENTIFIER"
, Opt.help "Name of a contract returned by `list` command."
]

-- | Parse the output `FilePath`
outputOptions :: Opt.Parser (Maybe FilePath)
outputOptions = optional . Opt.strOption $ mconcat
[ Opt.short 'o'
, Opt.long "output"
, Opt.metavar "FILEPATH"
, Opt.help "File to use as output. If not specified, stdout is used."
]

0 comments on commit 7e6c10b

Please sign in to comment.