diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-07-10 16:05:56 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-07-10 16:05:56 -0400 |
commit | aa96e9c8667b5e80b5ccae1958a073518d463dfa (patch) | |
tree | dc4452a8b96b9c47902a17e65541e71c506ec848 /CmdLine | |
parent | 00e37e72e06d3692ea2b5c77dfa6b0147a3b6d6d (diff) |
convert Unused, and remove some dead code for old style option parsing
Diffstat (limited to 'CmdLine')
-rw-r--r-- | CmdLine/GitAnnex.hs | 4 | ||||
-rw-r--r-- | CmdLine/Option.hs | 28 | ||||
-rw-r--r-- | CmdLine/Seek.hs | 10 |
3 files changed, 3 insertions, 39 deletions
diff --git a/CmdLine/GitAnnex.hs b/CmdLine/GitAnnex.hs index 81b9cd3d6..7119d1455 100644 --- a/CmdLine/GitAnnex.hs +++ b/CmdLine/GitAnnex.hs @@ -50,7 +50,7 @@ import qualified Command.InitRemote import qualified Command.EnableRemote --import qualified Command.Expire import qualified Command.Repair ---import qualified Command.Unused +import qualified Command.Unused --import qualified Command.DropUnused import qualified Command.AddUnused import qualified Command.Unlock @@ -180,7 +180,7 @@ cmds = , Command.Fix.cmd -- , Command.Expire.cmd , Command.Repair.cmd --- , Command.Unused.cmd + , Command.Unused.cmd -- , Command.DropUnused.cmd , Command.AddUnused.cmd , Command.Find.cmd diff --git a/CmdLine/Option.hs b/CmdLine/Option.hs index 9f2353f98..4e201cbd4 100644 --- a/CmdLine/Option.hs +++ b/CmdLine/Option.hs @@ -5,18 +5,9 @@ - Licensed under the GNU GPL version 3 or higher. -} -module CmdLine.Option ( - commonGlobalOptions, - flagOption, - fieldOption, - optionName, - optionParam, - ArgDescr(..), - OptDescr(..), -) where +module CmdLine.Option where import Options.Applicative -import System.Console.GetOpt import Common.Annex import CmdLine.Usage @@ -70,20 +61,3 @@ commonGlobalOptions = setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v } setdebug = Annex.changeGitConfig $ \c -> c { annexDebug = True } unsetdebug = Annex.changeGitConfig $ \c -> c { annexDebug = False } - -{- An option that sets a flag. -} -flagOption :: String -> String -> String -> Option -flagOption shortv opt description = - Option shortv [opt] (NoArg (Annex.setFlag opt)) description - -{- An option that sets a field. -} -fieldOption :: String -> String -> String -> String -> Option -fieldOption shortv opt paramdesc description = - Option shortv [opt] (ReqArg (Annex.setField opt) paramdesc) description - -{- The flag or field name used for an option. -} -optionName :: Option -> String -optionName (Option _ o _ _) = Prelude.head o - -optionParam :: Option -> String -optionParam o = "--" ++ optionName o diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs index b40e0d17a..e67c3b908 100644 --- a/CmdLine/Seek.hs +++ b/CmdLine/Seek.hs @@ -22,7 +22,6 @@ import qualified Git.LsFiles as LsFiles import qualified Git.LsTree as LsTree import Git.FilePath import qualified Limit -import CmdLine.Option import CmdLine.GitAnnex.Options import CmdLine.Action import Logs.Location @@ -152,15 +151,6 @@ withKeys a params = seekActions $ return $ map (a . parse) params where parse p = fromMaybe (error "bad key") $ file2key p -{- Gets the value of a field options, which is fed into - - a conversion function. - -} -getOptionField :: Option -> (Maybe String -> Annex a) -> Annex a -getOptionField option converter = converter <=< Annex.getField $ optionName option - -getOptionFlag :: Option -> Annex Bool -getOptionFlag option = Annex.getFlag (optionName option) - withNothing :: CommandStart -> CmdParams -> CommandSeek withNothing a [] = seekActions $ return [a] withNothing _ _ = error "This command takes no parameters." |