diff options
-rw-r--r-- | CmdLine/GitAnnex/Options.hs | 8 | ||||
-rw-r--r-- | Command/Drop.hs | 2 | ||||
-rw-r--r-- | Command/Fsck.hs | 4 |
3 files changed, 4 insertions, 10 deletions
diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs index 1472a4d2b..160c01a3a 100644 --- a/CmdLine/GitAnnex/Options.hs +++ b/CmdLine/GitAnnex/Options.hs @@ -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 diff --git a/Command/Drop.hs b/Command/Drop.hs index b569491bb..e246af342 100644 --- a/Command/Drop.hs +++ b/Command/Drop.hs @@ -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 diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 486b686d5..885ce17dd 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -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" |