The file matching options are now only accepted by commands that can actually use them.
This commit is contained in:
parent
52424dc382
commit
8066a1c3cc
24 changed files with 118 additions and 77 deletions
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -62,7 +62,7 @@ fsckOptions =
|
|||
, startIncrementalOption
|
||||
, moreIncrementalOption
|
||||
, incrementalScheduleOption
|
||||
] ++ keyOptions
|
||||
] ++ keyOptions ++ annexedMatchingOptions
|
||||
|
||||
seek :: CommandSeek
|
||||
seek ps = do
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -26,7 +26,7 @@ opts =
|
|||
, deduplicateOption
|
||||
, cleanDuplicatesOption
|
||||
, skipDuplicatesOption
|
||||
]
|
||||
] ++ fileMatchingOptions
|
||||
|
||||
duplicateOption :: Option
|
||||
duplicateOption = flagOption [] "duplicate" "do not delete source files"
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"] ++
|
||||
|
|
|
@ -28,7 +28,7 @@ metaDataOptions =
|
|||
, untagOption
|
||||
, getOption
|
||||
, jsonOption
|
||||
] ++ keyOptions
|
||||
] ++ keyOptions ++ annexedMatchingOptions
|
||||
|
||||
storeModMeta :: ModMeta -> Annex ()
|
||||
storeModMeta modmeta = Annex.changeState $
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue