addcomputed inherits extra initremote parameters
This is limited because the remote config is a field/value map. So order is not preserved, and when 2 parameters have the same field name, only the last one will be passed.
This commit is contained in:
parent
a5b53fa98a
commit
eed522a0f8
4 changed files with 21 additions and 12 deletions
|
@ -88,8 +88,8 @@ perform o r program = do
|
||||||
repopath <- fromRepo Git.repoPath
|
repopath <- fromRepo Git.repoPath
|
||||||
subdir <- liftIO $ relPathDirToFile repopath (literalOsPath ".")
|
subdir <- liftIO $ relPathDirToFile repopath (literalOsPath ".")
|
||||||
let state = Remote.Compute.ComputeState
|
let state = Remote.Compute.ComputeState
|
||||||
-- TODO add inherited initremote parameters
|
{ Remote.Compute.computeParams = computeParams o ++
|
||||||
{ Remote.Compute.computeParams = computeParams o
|
Remote.Compute.defaultComputeParams r
|
||||||
, Remote.Compute.computeInputs = mempty
|
, Remote.Compute.computeInputs = mempty
|
||||||
, Remote.Compute.computeOutputs = mempty
|
, Remote.Compute.computeOutputs = mempty
|
||||||
, Remote.Compute.computeSubdir = subdir
|
, Remote.Compute.computeSubdir = subdir
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Remote.Compute (
|
||||||
getComputeProgram,
|
getComputeProgram,
|
||||||
runComputeProgram,
|
runComputeProgram,
|
||||||
ImmutableState(..),
|
ImmutableState(..),
|
||||||
|
defaultComputeParams,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
|
@ -127,6 +128,11 @@ computeConfigParser _ = return $ RemoteConfigParser
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defaultComputeParams :: Remote -> [String]
|
||||||
|
defaultComputeParams = map mk . M.toList . getRemoteConfigPassedThrough . config
|
||||||
|
where
|
||||||
|
mk (f, v) = fromProposedAccepted f ++ '=' : v
|
||||||
|
|
||||||
newtype ComputeProgram = ComputeProgram String
|
newtype ComputeProgram = ComputeProgram String
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,9 @@ Some examples of how this might look:
|
||||||
git-annex addcomputed --to=y -- compress foo --level=9
|
git-annex addcomputed --to=y -- compress foo --level=9
|
||||||
git-annex addcomputed --to=z -- clip foo 2:01-3:00 combine with bar to baz
|
git-annex addcomputed --to=z -- clip foo 2:01-3:00 combine with bar to baz
|
||||||
|
|
||||||
|
Note that parameters that were passed to `git-annex initremote`
|
||||||
|
when setting up the compute special remote will be appended to the end of
|
||||||
|
the parameters provided to `git-annex addcomputed`.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
|
|
||||||
|
@ -88,6 +90,8 @@ Some examples of how this might look:
|
||||||
|
|
||||||
[[git-annex-recompute]](1)
|
[[git-annex-recompute]](1)
|
||||||
|
|
||||||
|
[[git-annex-initremote]](1)
|
||||||
|
|
||||||
# AUTHOR
|
# AUTHOR
|
||||||
|
|
||||||
Joey Hess <id@joeyh.name>
|
Joey Hess <id@joeyh.name>
|
||||||
|
|
|
@ -2,6 +2,10 @@ While other remotes store the contents of annexed files somewhere,
|
||||||
this special remote uses a program to compute the contents of annexed
|
this special remote uses a program to compute the contents of annexed
|
||||||
files.
|
files.
|
||||||
|
|
||||||
|
To add a file to a compute special remote, use the [[git-annex-addcomputed]]
|
||||||
|
command. Once a file has been added to a compute special remote, commands
|
||||||
|
like `git-annex get` will use it to compute the content of the file.
|
||||||
|
|
||||||
To enable an instance of this special remote:
|
To enable an instance of this special remote:
|
||||||
|
|
||||||
# git-annex initremote myremote type=compute program=git-annex-compute-foo
|
# git-annex initremote myremote type=compute program=git-annex-compute-foo
|
||||||
|
@ -11,16 +15,11 @@ program to use to compute the contents of annexed files. It must start with
|
||||||
"git-annex-compute-". The program needs to be installed somewhere in the
|
"git-annex-compute-". The program needs to be installed somewhere in the
|
||||||
`PATH`.
|
`PATH`.
|
||||||
|
|
||||||
To add a file to a compute special remote, use the [[git-annex-addcomputed]]
|
All other "field=value" parameters passed to `initremote` will be passed
|
||||||
command. Once a file has been added to a compute special remote, commands
|
to the program when running [[git-annex-addcomputed]]. Note that when the
|
||||||
like `git-annex get` will use it to compute the content of the file.
|
program takes a dashed option, it can be provided after "--":
|
||||||
|
|
||||||
You can provide other parameters to `initremote`, in order to provide
|
# git-annex initremote myremote type=compute program=git-annex-compute-foo -- --level=9
|
||||||
default configuration values to use when adding files with
|
|
||||||
[[git-annex-addcomputed]]. To see a list of all the configuration values
|
|
||||||
supported by a given program, pass `--whatelse` to `initremote`:
|
|
||||||
|
|
||||||
# git-annex initremote myremote type=compute program=git-annex-compute-foo --whatelse
|
|
||||||
|
|
||||||
## compute programs
|
## compute programs
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue