summaryrefslogtreecommitdiff
path: root/Command/View.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Command/View.hs')
-rw-r--r--Command/View.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Command/View.hs b/Command/View.hs
index 17e136f7b..e5182e852 100644
--- a/Command/View.hs
+++ b/Command/View.hs
@@ -14,6 +14,7 @@ import qualified Git.Command
import qualified Git.Ref
import qualified Git.Branch
import Types.MetaData
+import Annex.MetaData
import Types.View
import Annex.View
import Logs.View
@@ -43,12 +44,19 @@ perform view = do
next $ checkoutViewBranch view applyView
paramView :: String
-paramView = paramPair (paramRepeating "FIELD=VALUE") (paramRepeating "TAG")
+paramView = paramPair (paramRepeating "TAG") (paramRepeating "FIELD=VALUE")
+{- Parse field=value
+ -
+ - Note that the field may not be a legal metadata field name,
+ - but it's let through anywa (using MetaField rather than mkMetaField).
+ - This is useful when matching on directory names with spaces,
+ - which are not legal MetaFields.
+ -}
parseViewParam :: String -> (MetaField, String)
parseViewParam s = case separate (== '=') s of
(tag, []) -> (tagMetaField, tag)
- (field, wanted) -> either error (\f -> (f, wanted)) (mkMetaField field)
+ (field, wanted) -> (MetaField field, wanted)
mkView :: [String] -> Annex View
mkView params = do