Skip to content

Commit 0a24beb

Browse files
committed
Auto merge of #9747 - lf-:document-pathandargs-doc-browser, r=ehuss
doc: Clarify [doc].browser docs, document PathAndArgs better I was talking to someone who was confused about the [doc].browser value type as it related to using a path with a space in it, and it seemed like this area needed clarification in general.
2 parents 97641b1 + 1c44404 commit 0a24beb

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/doc/src/reference/config.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,20 @@ runner = "foo" # Searches `PATH` for `foo`.
203203
directory = "vendor"
204204
```
205205

206+
### Executable paths with arguments
207+
208+
Some Cargo commands invoke external programs, which can be configured as a path
209+
and some number of arguments.
210+
211+
The value may be an array of strings like `['/path/to/program', 'somearg']` or
212+
a space-separated string like `'/path/to/program somearg'`. If the path to the
213+
executable contains a space, the list form must be used.
214+
215+
If Cargo is passing other arguments to the program such as a path to open or
216+
run, they will be passed after the last specified argument in the value of an
217+
option of this format. If the specified program does not have path separators,
218+
Cargo will search `PATH` for its executable.
219+
206220
### Credentials
207221

208222
Configuration values with sensitive information are stored in the
@@ -425,6 +439,10 @@ The `[doc]` table defines options for the [`cargo doc`] command.
425439

426440
##### `doc.browser`
427441

442+
* Type: string or array of strings ([program path and args])
443+
* Default: `BROWSER` environment variable, or, if that is missing,
444+
opening the link in a system specific way
445+
428446
This option sets the browser to be used by [`cargo doc`], overriding the
429447
`BROWSER` environment variable when opening documentation with the `--open`
430448
option.
@@ -856,7 +874,7 @@ Specifies the linker which is passed to `rustc` (via [`-C linker`]) when the
856874
`<triple>` is being compiled for. By default, the linker is not overridden.
857875

858876
##### `target.<triple>.runner`
859-
* Type: string or array of strings (program path and args)
877+
* Type: string or array of strings ([program path and args])
860878
* Default: none
861879
* Environment: `CARGO_TARGET_<triple>_RUNNER`
862880

@@ -865,12 +883,6 @@ executed by invoking the specified runner with the actual executable passed as
865883
an argument. This applies to [`cargo run`], [`cargo test`] and [`cargo bench`]
866884
commands. By default, compiled executables are executed directly.
867885

868-
The value may be an array of strings like `['/path/to/program', 'somearg']` or
869-
a space-separated string like `'/path/to/program somearg'`. The arguments will
870-
be passed to the runner with the executable to run as the last argument. If
871-
the runner program does not have path separators, it will search `PATH` for
872-
the runner executable.
873-
874886
##### `target.<cfg>.runner`
875887

876888
This is similar to the [target runner](#targettriplerunner), but using
@@ -977,6 +989,7 @@ Sets the width for progress bar.
977989
[toml]: https://toml.io/
978990
[incremental compilation]: profiles.md#incremental
979991
[profile]: profiles.md
992+
[program path with args]: #executable-paths-with-arguments
980993
[libcurl format]: https://ec.haxx.se/usingcurl-proxies.html
981994
[source replacement]: source-replacement.md
982995
[revision]: https://git-scm.com/docs/gitrevisions

0 commit comments

Comments
 (0)