summaryrefslogtreecommitdiff
path: root/Command/View.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-08 15:08:02 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-08 15:08:02 -0400
commite7e61fb6cbe5455ded9bb550a64121223c099fc2 (patch)
tree003a99697256ea516ad40f9fbdb854996b58c0cd /Command/View.hs
parent8879c96d157f06bbd2372064251676b7927ce38e (diff)
convert all commands to work with optparse-applicative
Still no options though.
Diffstat (limited to 'Command/View.hs')
-rw-r--r--Command/View.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Command/View.hs b/Command/View.hs
index 584cf091f..b39aef7d9 100644
--- a/Command/View.hs
+++ b/Command/View.hs
@@ -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