From 37133e77cfbdd42139668a4a35be7a3f4f0435c1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 21 Feb 2025 10:09:32 -0800 Subject: [PATCH] Document precedence order of CLI/config options Closes #10258 --- docs/cli-options.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/cli-options.md b/docs/cli-options.md index 3d9bf95923db..07d059f30683 100644 --- a/docs/cli-options.md +++ b/docs/cli-options.md @@ -129,13 +129,13 @@ $ wasmtime settings # Additional options Many of the above subcommands also take additional options. For example, -- run +- run - serve - compile - explore - wast -are all subcommands which can take additional CLI options of the format +are all subcommands which can take additional CLI options of the format ```sh Options: @@ -158,11 +158,11 @@ Options: For example, adding `--optimize opt-level=0` to a `wasmtime compile` subcommand will turn off most optimizations for the generated code. -## CLI options using TOML file +## CLI options using TOML file Most key-value options that can be provided using the `--optimize`, `--codegen`, `--debug`, `--wasm`, and `--wasi` flags can also be provided using a TOML file using the `--config ` cli flag, by putting the key-value inside a TOML -table with the same name. +table with the same name. For example, with a TOML file like this ```toml @@ -172,10 +172,14 @@ opt-level = 0 the command ```sh $ wasmtime compile --config config.toml -``` -would be the same as +``` +would be the same as ```sh $ wasmtime compile --optimize opt-level=0 ``` assuming the TOML file is called `config.toml`. Of course you can put as many key-value pairs as you want in the TOML file. + +Options on the CLI take precedent over options specified in a configuration +file, meaning they're allowed to shadow configuration values in a TOML +configuration file.