drop: Add --batch and --json options.
This commit is contained in:
parent
a0d6ec1c8a
commit
5171e98988
5 changed files with 28 additions and 6 deletions
|
@ -3,7 +3,7 @@ git-annex (6.20160614) UNRELEASED; urgency=medium
|
|||
* Webapp: Don't allow deleting a remote that has syncing disabled,
|
||||
as such a deletion will never finish.
|
||||
Thanks, Farhan Kathawala.
|
||||
* get: Add --batch and --json options.
|
||||
* get, drop: Add --batch and --json options.
|
||||
* New url for git-remote-gcrypt, now maintained by spwhitton.
|
||||
* testremote: Fix crash when testing a freshly made external special remote.
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import System.Log.Logger (debugM)
|
|||
import qualified Data.Set as S
|
||||
|
||||
cmd :: Command
|
||||
cmd = withGlobalOptions (jobsOption : annexedMatchingOptions) $
|
||||
cmd = withGlobalOptions (jobsOption : jsonOption : annexedMatchingOptions) $
|
||||
command "drop" SectionCommon
|
||||
"remove content of files from repository"
|
||||
paramPaths (seek <$$> optParser)
|
||||
|
@ -33,6 +33,7 @@ data DropOptions = DropOptions
|
|||
, dropFrom :: Maybe (DeferredParse Remote)
|
||||
, autoMode :: Bool
|
||||
, keyOptions :: Maybe KeyOptions
|
||||
, batchOption :: BatchMode
|
||||
}
|
||||
|
||||
optParser :: CmdParamsDesc -> Parser DropOptions
|
||||
|
@ -41,6 +42,7 @@ optParser desc = DropOptions
|
|||
<*> optional parseDropFromOption
|
||||
<*> parseAutoOption
|
||||
<*> optional (parseKeyOptions False)
|
||||
<*> parseBatchOption
|
||||
|
||||
parseDropFromOption :: Parser (DeferredParse Remote)
|
||||
parseDropFromOption = parseRemoteOption $ strOption
|
||||
|
@ -51,10 +53,14 @@ parseDropFromOption = parseRemoteOption $ strOption
|
|||
|
||||
seek :: DropOptions -> CommandSeek
|
||||
seek o = allowConcurrentOutput $
|
||||
withKeyOptions (keyOptions o) (autoMode o)
|
||||
(startKeys o)
|
||||
(withFilesInGit $ whenAnnexed $ start o)
|
||||
(dropFiles o)
|
||||
case batchOption o of
|
||||
Batch -> batchInput Right (batchCommandAction . go)
|
||||
NoBatch -> withKeyOptions (keyOptions o) (autoMode o)
|
||||
(startKeys o)
|
||||
(withFilesInGit go)
|
||||
(dropFiles o)
|
||||
where
|
||||
go = whenAnnexed $ start o
|
||||
|
||||
start :: DropOptions -> FilePath -> Key -> CommandStart
|
||||
start o file key = start' o key (Just file)
|
||||
|
|
|
@ -61,6 +61,16 @@ safe to do so.
|
|||
when git-annex has to contact remotes to check if it can drop files.
|
||||
For example: `-J4`
|
||||
|
||||
* `--batch`
|
||||
|
||||
Enables batch mode, in which lines containing names of files to drop
|
||||
are read from stdin.
|
||||
|
||||
* `--json`
|
||||
|
||||
Enable JSON output. This is intended to be parsed by programs that use
|
||||
git-annex. Each line of output is a JSON object.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
[[git-annex]](1)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
in the spirit of [[todo/--batch_for_add/]], [[todo/--batch_for_info/]], [[todo/--batch_for_find/]] and [[todo/--batch_for_whereis/]], why not add `--batch` to get/drop/import operations?
|
||||
|
||||
I am writing a script to get a bunch of arbitrary files and i want to avoid the overhead of running git-annex multiple times. I know i can use `annex.alwayscommit=false` but that is rather counter-intuitive as well. --[[anarcat]]
|
||||
|
||||
> [[done]] for add and drop. (Not for import, but if someone requests it
|
||||
> with a use case we'll see.) --[[Joey]]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
There is a dropkey --batch, so I guess I could workaround but probably would be nice for consistency to have --batch mode for drop itself as well
|
||||
|
||||
[[!meta author=yoh]]
|
||||
|
||||
> [[done]]; went ahead and added drop --batch to be symmetric with get
|
||||
> --batch. --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue