convert all commands to work with optparse-applicative

Still no options though.
This commit is contained in:
Joey Hess 2015-07-08 15:08:02 -04:00
parent 3125da54f6
commit 6e5c1f8db3
99 changed files with 391 additions and 297 deletions

View file

@ -19,16 +19,17 @@ import Logs.View
cmd :: Command
cmd = notBareRepo $ notDirect $
command "view" paramView seek SectionMetaData "enter a view branch"
command "view" SectionMetaData "enter a view branch"
paramView (withParams seek)
seek :: CommandSeek
seek :: CmdParams -> CommandSeek
seek = withWords start
start :: [String] -> CommandStart
start [] = error "Specify metadata to include in view"
start params = do
start ps = do
showStart "view" ""
view <- mkView params
view <- mkView ps
go view =<< currentView
where
go view Nothing = next $ perform view
@ -45,11 +46,11 @@ paramView :: String
paramView = paramRepeating "FIELD=VALUE"
mkView :: [String] -> Annex View
mkView params = go =<< inRepo Git.Branch.current
mkView ps = go =<< inRepo Git.Branch.current
where
go Nothing = error "not on any branch!"
go (Just b) = return $ fst $ refineView (View b []) $
map parseViewParam $ reverse params
map parseViewParam $ reverse ps
checkoutViewBranch :: View -> (View -> Annex Git.Branch) -> CommandCleanup
checkoutViewBranch view mkbranch = do