clarify default values when no path is specified
Much of the code to handle this was unnecessary, as git ls-files is used, and defaults to returning all files of the desired type.
This commit is contained in:
parent
2a67721d51
commit
23686cc63d
5 changed files with 6 additions and 17 deletions
13
Command.hs
13
Command.hs
|
@ -174,19 +174,6 @@ backendPairs a files = do
|
||||||
pairs <- Backend.chooseBackends files
|
pairs <- Backend.chooseBackends files
|
||||||
return $ map a pairs
|
return $ map a pairs
|
||||||
|
|
||||||
{- Default to acting on all files matching the seek action if
|
|
||||||
- none are specified. -}
|
|
||||||
withAll :: (a -> CommandSeek) -> a -> CommandSeek
|
|
||||||
withAll w a [] = do
|
|
||||||
g <- Annex.gitRepo
|
|
||||||
w a [Git.workTree g]
|
|
||||||
withAll w a p = w a p
|
|
||||||
|
|
||||||
{- Provides a default parameter to act on if none is specified. -}
|
|
||||||
withDefault :: String-> (a -> CommandSeek) -> (a -> CommandSeek)
|
|
||||||
withDefault d w a [] = w a [d]
|
|
||||||
withDefault _ w a p = w a p
|
|
||||||
|
|
||||||
{- Filter out files from the state directory, and those matching the
|
{- Filter out files from the state directory, and those matching the
|
||||||
- exclude glob pattern, if it was specified. -}
|
- exclude glob pattern, if it was specified. -}
|
||||||
filterFiles :: [FilePath] -> Annex [FilePath]
|
filterFiles :: [FilePath] -> Annex [FilePath]
|
||||||
|
|
|
@ -18,7 +18,7 @@ command = [Command "find" (paramOptional $ paramRepeating paramPath) seek
|
||||||
"lists available files"]
|
"lists available files"]
|
||||||
|
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withDefault "." withFilesInGit start]
|
seek = [withFilesInGit start]
|
||||||
|
|
||||||
{- Output a list of files. -}
|
{- Output a list of files. -}
|
||||||
start :: CommandStartString
|
start :: CommandStartString
|
||||||
|
|
|
@ -18,7 +18,7 @@ command = [Command "fsck" (paramOptional $ paramRepeating paramPath) seek
|
||||||
"check for problems"]
|
"check for problems"]
|
||||||
|
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withAll (withAttrFilesInGit "annex.numcopies") start]
|
seek = [withAttrFilesInGit "annex.numcopies" start]
|
||||||
|
|
||||||
{- Checks a file's backend data for problems. -}
|
{- Checks a file's backend data for problems. -}
|
||||||
start :: CommandStartAttrFile
|
start :: CommandStartAttrFile
|
||||||
|
|
|
@ -25,7 +25,7 @@ command = [Command "uninit" paramPath seek
|
||||||
"de-initialize git-annex and clean out repository"]
|
"de-initialize git-annex and clean out repository"]
|
||||||
|
|
||||||
seek :: [CommandSeek]
|
seek :: [CommandSeek]
|
||||||
seek = [withAll withFilesInGit Command.Unannex.start, withNothing start]
|
seek = [withFilesInGit Command.Unannex.start, withNothing start]
|
||||||
|
|
||||||
start :: CommandStartNothing
|
start :: CommandStartNothing
|
||||||
start = do
|
start = do
|
||||||
|
|
|
@ -59,7 +59,9 @@ content from the key-value store.
|
||||||
|
|
||||||
Like many git commands, git-annex can be passed a path that
|
Like many git commands, git-annex can be passed a path that
|
||||||
is either a file or a directory. In the latter case it acts on all relevant
|
is either a file or a directory. In the latter case it acts on all relevant
|
||||||
files in the directory.
|
files in the directory. If no path is specified, most git-annex commands
|
||||||
|
default to acting on all relevant files in the current directory (and
|
||||||
|
subdirectories).
|
||||||
|
|
||||||
Many git-annex commands will stage changes for later `git commit` by you.
|
Many git-annex commands will stage changes for later `git commit` by you.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue