finalOpt is the same as optional
This commit is contained in:
parent
463709ab2a
commit
d8d1499229
3 changed files with 4 additions and 10 deletions
|
@ -84,7 +84,7 @@ parseUnusedKeysOption = switch
|
|||
)
|
||||
|
||||
parseSpecificKeyOption :: Parser (Maybe Key)
|
||||
parseSpecificKeyOption = finalOpt $ option (str >>= parseKey)
|
||||
parseSpecificKeyOption = optional $ option (str >>= parseKey)
|
||||
( long "key"
|
||||
<> help "operate on specified key"
|
||||
<> metavar paramKey
|
||||
|
@ -201,9 +201,3 @@ parseAutoOption = switch
|
|||
{- Parser that accepts all non-option params. -}
|
||||
cmdParams :: CmdParamsDesc -> Parser CmdParams
|
||||
cmdParams paramdesc = many (argument str (metavar paramdesc))
|
||||
|
||||
{- Makes an option parser that is normally required be optional;
|
||||
- - its switch can be given zero or more times, and the last one
|
||||
- - given will be used. -}
|
||||
finalOpt :: Parser a -> Parser (Maybe a)
|
||||
finalOpt = lastMaybe <$$> many
|
||||
|
|
|
@ -46,7 +46,7 @@ optParser desc = DropOptions
|
|||
<*> parseKeyOptions False
|
||||
|
||||
parseDropFromOption :: Parser (Maybe RemoteName)
|
||||
parseDropFromOption = finalOpt $ strOption
|
||||
parseDropFromOption = optional $ strOption
|
||||
( long "from"
|
||||
<> short 'f'
|
||||
<> metavar paramRemote
|
||||
|
|
|
@ -59,7 +59,7 @@ data FsckOptions = FsckOptions
|
|||
optParser :: CmdParamsDesc -> Parser FsckOptions
|
||||
optParser desc = FsckOptions
|
||||
<$> cmdParams desc
|
||||
<*> finalOpt (strOption
|
||||
<*> optional (strOption
|
||||
( long "from"
|
||||
<> short 'f'
|
||||
<> metavar paramRemote
|
||||
|
@ -75,7 +75,7 @@ optParser desc = FsckOptions
|
|||
<> short 'm'
|
||||
<> help "continue an incremental fsck"
|
||||
)
|
||||
<*> finalOpt (option (str >>= parseDuration)
|
||||
<*> optional (option (str >>= parseDuration)
|
||||
( long "incremental-schedule"
|
||||
<> metavar paramTime
|
||||
<> help "schedule incremental fscking"
|
||||
|
|
Loading…
Reference in a new issue