Allow --resource-path
to accumulate.
Previously, if `--resource-path` were used multiple times, the last resource path would replace the others. With this change, each time `--resource-path` is used, it prepends the specified path components to the existing resource path. Similarly, when `resource-path` is specified in a defaults file, the paths provided will be prepended to the existing resource path. This change also allows one to avoid using the OS-specific path separator; instead, one can simply use `--resource-path` a number of times with single paths. This form of command will not have an OS-dependent behavior. This change facilitates the use of multiple, small defaults files: each can specify a directory containing its own resources without clobbering the resource paths set by the others. Closes #6152.
This commit is contained in:
parent
26524246d0
commit
735a69de6b
3 changed files with 9 additions and 2 deletions
|
@ -891,6 +891,11 @@ header when requesting a document from a URL:
|
||||||
will not be searched. For example:
|
will not be searched. For example:
|
||||||
`--resource-path=.:test` will search the working directory
|
`--resource-path=.:test` will search the working directory
|
||||||
and the `test` subdirectory, in that order.
|
and the `test` subdirectory, in that order.
|
||||||
|
This option can be used repeatedly. Search path components
|
||||||
|
that come later on the command line will be searched before
|
||||||
|
those that come earlier, so
|
||||||
|
`--resource-path foo:bar --resource-path baz:bim` is
|
||||||
|
equivalent to `--resource-path baz:bim:foo:bar`.
|
||||||
|
|
||||||
`--request-header=`*NAME*`:`*VAL*
|
`--request-header=`*NAME*`:`*VAL*
|
||||||
|
|
||||||
|
|
|
@ -288,7 +288,8 @@ options =
|
||||||
, Option "" ["resource-path"]
|
, Option "" ["resource-path"]
|
||||||
(ReqArg
|
(ReqArg
|
||||||
(\arg opt -> return opt { optResourcePath =
|
(\arg opt -> return opt { optResourcePath =
|
||||||
splitSearchPath arg })
|
splitSearchPath arg ++
|
||||||
|
optResourcePath opt })
|
||||||
"SEARCHPATH")
|
"SEARCHPATH")
|
||||||
"" -- "Paths to search for images and other resources"
|
"" -- "Paths to search for images and other resources"
|
||||||
|
|
||||||
|
|
|
@ -583,7 +583,8 @@ doOpt (k',v) = do
|
||||||
optIncludeInHeader o <> [unpack x] }))
|
optIncludeInHeader o <> [unpack x] }))
|
||||||
"resource-path" ->
|
"resource-path" ->
|
||||||
parseYAML v >>= \x ->
|
parseYAML v >>= \x ->
|
||||||
return (\o -> o{ optResourcePath = map unpack x })
|
return (\o -> o{ optResourcePath = map unpack x <>
|
||||||
|
optResourcePath o })
|
||||||
"request-headers" ->
|
"request-headers" ->
|
||||||
parseYAML v >>= \x ->
|
parseYAML v >>= \x ->
|
||||||
return (\o -> o{ optRequestHeaders = x })
|
return (\o -> o{ optRequestHeaders = x })
|
||||||
|
|
Loading…
Reference in a new issue