summaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
Diffstat (limited to 'Command')
-rw-r--r--Command/Add.hs8
-rw-r--r--Command/Drop.hs5
-rw-r--r--Command/Find.hs3
-rw-r--r--Command/FindRef.hs5
-rw-r--r--Command/Fix.hs5
-rw-r--r--Command/Fsck.hs2
-rw-r--r--Command/Get.hs2
-rw-r--r--Command/Import.hs2
-rw-r--r--Command/Info.hs2
-rw-r--r--Command/List.hs5
-rw-r--r--Command/Lock.hs3
-rw-r--r--Command/Log.hs2
-rw-r--r--Command/MetaData.hs2
-rw-r--r--Command/Migrate.hs2
-rw-r--r--Command/Mirror.hs2
-rw-r--r--Command/Move.hs2
-rw-r--r--Command/Unannex.hs3
-rw-r--r--Command/Unlock.hs3
-rw-r--r--Command/Whereis.hs2
19 files changed, 36 insertions, 24 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 51921fbc3..7faa7c80d 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -35,9 +35,11 @@ import Utility.Tmp
import Control.Exception (IOException)
cmd :: [Command]
-cmd = [notBareRepo $ withOptions [includeDotFilesOption] $
- command "add" paramPaths seek SectionCommon
- "add files to annex"]
+cmd = [notBareRepo $ withOptions addOptions $
+ command "add" paramPaths seek SectionCommon "add files to annex"]
+
+addOptions :: [Option]
+addOptions = includeDotFilesOption : fileMatchingOptions
includeDotFilesOption :: Option
includeDotFilesOption = flagOption [] "include-dotfiles" "don't skip dotfiles"
diff --git a/Command/Drop.hs b/Command/Drop.hs
index 6adc13ca5..35c2f5cf4 100644
--- a/Command/Drop.hs
+++ b/Command/Drop.hs
@@ -23,9 +23,12 @@ import Annex.Notification
import qualified Data.Set as S
cmd :: [Command]
-cmd = [withOptions [dropFromOption] $ command "drop" paramPaths seek
+cmd = [withOptions (dropOptions) $ command "drop" paramPaths seek
SectionCommon "indicate content of files not currently wanted"]
+dropOptions :: [Option]
+dropOptions = dropFromOption : annexedMatchingOptions
+
dropFromOption :: Option
dropFromOption = fieldOption ['f'] "from" paramRemote "drop content from a remote"
diff --git a/Command/Find.hs b/Command/Find.hs
index 55124d838..236824643 100644
--- a/Command/Find.hs
+++ b/Command/Find.hs
@@ -20,7 +20,8 @@ import Utility.DataUnits
import Types.Key
cmd :: [Command]
-cmd = [mkCommand $ command "find" paramPaths seek SectionQuery "lists available files"]
+cmd = [withOptions annexedMatchingOptions $ mkCommand $
+ command "find" paramPaths seek SectionQuery "lists available files"]
mkCommand :: Command -> Command
mkCommand = noCommit . noMessages . withOptions [formatOption, print0Option, jsonOption]
diff --git a/Command/FindRef.hs b/Command/FindRef.hs
index 2e3d859fa..e7f7eae6d 100644
--- a/Command/FindRef.hs
+++ b/Command/FindRef.hs
@@ -11,8 +11,9 @@ import Command
import qualified Command.Find as Find
cmd :: [Command]
-cmd = [Find.mkCommand $ command "findref" paramRef seek SectionPlumbing
- "lists files in a git ref"]
+cmd = [withOptions nonWorkTreeMatchingOptions $ Find.mkCommand $
+ command "findref" paramRef seek SectionPlumbing
+ "lists files in a git ref"]
seek :: CommandSeek
seek refs = do
diff --git a/Command/Fix.hs b/Command/Fix.hs
index c981d23ae..c4e5e52ee 100644
--- a/Command/Fix.hs
+++ b/Command/Fix.hs
@@ -19,8 +19,9 @@ import Utility.Touch
#endif
cmd :: [Command]
-cmd = [notDirect $ noCommit $ command "fix" paramPaths seek
- SectionMaintenance "fix up symlinks to point to annexed content"]
+cmd = [notDirect $ noCommit $ withOptions annexedMatchingOptions $
+ command "fix" paramPaths seek
+ SectionMaintenance "fix up symlinks to point to annexed content"]
seek :: CommandSeek
seek = withFilesInGit $ whenAnnexed start
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index 0242a1f75..e8b1d240c 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -62,7 +62,7 @@ fsckOptions =
, startIncrementalOption
, moreIncrementalOption
, incrementalScheduleOption
- ] ++ keyOptions
+ ] ++ keyOptions ++ annexedMatchingOptions
seek :: CommandSeek
seek ps = do
diff --git a/Command/Get.hs b/Command/Get.hs
index b1929a79c..85960fc1a 100644
--- a/Command/Get.hs
+++ b/Command/Get.hs
@@ -21,7 +21,7 @@ cmd = [withOptions getOptions $ command "get" paramPaths seek
SectionCommon "make content of annexed files available"]
getOptions :: [Option]
-getOptions = fromOption : keyOptions
+getOptions = fromOption : annexedMatchingOptions ++ keyOptions
seek :: CommandSeek
seek ps = do
diff --git a/Command/Import.hs b/Command/Import.hs
index 29c139eb6..196f27738 100644
--- a/Command/Import.hs
+++ b/Command/Import.hs
@@ -26,7 +26,7 @@ opts =
, deduplicateOption
, cleanDuplicatesOption
, skipDuplicatesOption
- ]
+ ] ++ fileMatchingOptions
duplicateOption :: Option
duplicateOption = flagOption [] "duplicate" "do not delete source files"
diff --git a/Command/Info.hs b/Command/Info.hs
index 6fb411ec3..e04a72a3c 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -77,7 +77,7 @@ emptyStatInfo = StatInfo Nothing Nothing M.empty Nothing
type StatState = StateT StatInfo Annex
cmd :: [Command]
-cmd = [noCommit $ dontCheck repoExists $ withOptions [jsonOption] $
+cmd = [noCommit $ dontCheck repoExists $ withOptions (jsonOption : annexedMatchingOptions) $
command "info" (paramOptional $ paramRepeating paramItem) seek SectionQuery
"shows information about the specified item or the repository as a whole"]
diff --git a/Command/List.hs b/Command/List.hs
index bc4e3edec..b9b3a376c 100644
--- a/Command/List.hs
+++ b/Command/List.hs
@@ -24,8 +24,9 @@ import qualified Annex
import Git.Types (RemoteName)
cmd :: [Command]
-cmd = [noCommit $ withOptions [allrepos] $ command "list" paramPaths seek
- SectionQuery "show which remotes contain files"]
+cmd = [noCommit $ withOptions (allrepos : annexedMatchingOptions) $
+ command "list" paramPaths seek
+ SectionQuery "show which remotes contain files"]
allrepos :: Option
allrepos = flagOption [] "allrepos" "show all repositories, not only remotes"
diff --git a/Command/Lock.hs b/Command/Lock.hs
index 574e747c4..720169506 100644
--- a/Command/Lock.hs
+++ b/Command/Lock.hs
@@ -13,7 +13,8 @@ import qualified Annex.Queue
import qualified Annex
cmd :: [Command]
-cmd = [notDirect $ command "lock" paramPaths seek SectionCommon
+cmd = [notDirect $ withOptions annexedMatchingOptions $
+ command "lock" paramPaths seek SectionCommon
"undo unlock command"]
seek :: CommandSeek
diff --git a/Command/Log.hs b/Command/Log.hs
index 7c48388c2..4bc7bb89a 100644
--- a/Command/Log.hs
+++ b/Command/Log.hs
@@ -39,7 +39,7 @@ cmd = [withOptions options $
command "log" paramPaths seek SectionQuery "shows location log"]
options :: [Option]
-options = passthruOptions ++ [gourceOption]
+options = passthruOptions ++ [gourceOption] ++ annexedMatchingOptions
passthruOptions :: [Option]
passthruOptions = map odate ["since", "after", "until", "before"] ++
diff --git a/Command/MetaData.hs b/Command/MetaData.hs
index 095637959..a16f4214a 100644
--- a/Command/MetaData.hs
+++ b/Command/MetaData.hs
@@ -28,7 +28,7 @@ metaDataOptions =
, untagOption
, getOption
, jsonOption
- ] ++ keyOptions
+ ] ++ keyOptions ++ annexedMatchingOptions
storeModMeta :: ModMeta -> Annex ()
storeModMeta modmeta = Annex.changeState $
diff --git a/Command/Migrate.hs b/Command/Migrate.hs
index 9c7dec9ef..46c0eb675 100644
--- a/Command/Migrate.hs
+++ b/Command/Migrate.hs
@@ -18,7 +18,7 @@ import qualified Command.ReKey
import qualified Command.Fsck
cmd :: [Command]
-cmd = [notDirect $
+cmd = [notDirect $ withOptions annexedMatchingOptions $
command "migrate" paramPaths seek
SectionUtility "switch data to different backend"]
diff --git a/Command/Mirror.hs b/Command/Mirror.hs
index 558f906c5..7d3a7ef67 100644
--- a/Command/Mirror.hs
+++ b/Command/Mirror.hs
@@ -18,7 +18,7 @@ import qualified Annex
import Config.NumCopies
cmd :: [Command]
-cmd = [withOptions (fromToOptions ++ keyOptions) $
+cmd = [withOptions (fromToOptions ++ annexedMatchingOptions ++ keyOptions) $
command "mirror" paramPaths seek
SectionCommon "mirror content of files to/from another repository"]
diff --git a/Command/Move.hs b/Command/Move.hs
index 4a3633e8f..5317cefdd 100644
--- a/Command/Move.hs
+++ b/Command/Move.hs
@@ -22,7 +22,7 @@ cmd = [withOptions moveOptions $ command "move" paramPaths seek
SectionCommon "move content of files to/from another repository"]
moveOptions :: [Option]
-moveOptions = fromToOptions ++ keyOptions
+moveOptions = fromToOptions ++ keyOptions ++ annexedMatchingOptions
seek :: CommandSeek
seek ps = do
diff --git a/Command/Unannex.hs b/Command/Unannex.hs
index a88b07c8b..3fe4cf69c 100644
--- a/Command/Unannex.hs
+++ b/Command/Unannex.hs
@@ -23,7 +23,8 @@ import Utility.CopyFile
import Command.PreCommit (lockPreCommitHook)
cmd :: [Command]
-cmd = [command "unannex" paramPaths seek SectionUtility
+cmd = [withOptions annexedMatchingOptions $
+ command "unannex" paramPaths seek SectionUtility
"undo accidential add command"]
seek :: CommandSeek
diff --git a/Command/Unlock.hs b/Command/Unlock.hs
index 31bc1f2e2..208381930 100644
--- a/Command/Unlock.hs
+++ b/Command/Unlock.hs
@@ -19,7 +19,8 @@ cmd =
, c "edit" "same as unlock"
]
where
- c n = notDirect . command n paramPaths seek SectionCommon
+ c n = notDirect . withOptions annexedMatchingOptions
+ . command n paramPaths seek SectionCommon
seek :: CommandSeek
seek = withFilesInGit $ whenAnnexed start
diff --git a/Command/Whereis.hs b/Command/Whereis.hs
index d612ce4f0..5f31998c5 100644
--- a/Command/Whereis.hs
+++ b/Command/Whereis.hs
@@ -16,7 +16,7 @@ import Logs.Trust
import Logs.Web
cmd :: [Command]
-cmd = [noCommit $ withOptions (jsonOption : keyOptions) $
+cmd = [noCommit $ withOptions (jsonOption : annexedMatchingOptions ++ keyOptions) $
command "whereis" paramPaths seek SectionQuery
"lists repositories that have file content"]