Skip to content

Commit

Permalink
cli: describe how to set a config value with apostrophes
Browse files Browse the repository at this point in the history
Apostrophes are not uncommon in e.g. `user.name`, so let's help the
user by providing examples.
  • Loading branch information
martinvonz committed Feb 7, 2025
1 parent a16555f commit f5fb73c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions cli/src/commands/config/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ pub struct ConfigSetArgs {
/// New value to set
///
/// The value should be specified as a TOML expression. If string value
/// doesn't contain any TOML constructs (such as array notation), quotes can
/// be omitted.
/// doesn't contain any TOML constructs (such as apostrophes or array
/// notation), quotes can be omitted. Note that the value may also need
/// shell quoting. The exact syntax depends on your shell. For example,
/// to set `foo.bar` to the string "don't" in Bash, use
/// `jj config set --user foo.bar '"don'\''t"'`. In Fish, use
/// `jj config set --user foo.bar '"don\'t"'`. Alternatively, use
/// `jj config edit` to edit the TOML file directly.
#[arg(required = true, value_parser = parse_value_or_bare_string)]
value: ConfigValue,
#[command(flatten)]
Expand Down
2 changes: 1 addition & 1 deletion cli/tests/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ Update config file to set the given option to a given value
* `<NAME>`
* `<VALUE>` — New value to set

The value should be specified as a TOML expression. If string value doesn't contain any TOML constructs (such as array notation), quotes can be omitted.
The value should be specified as a TOML expression. If string value doesn't contain any TOML constructs (such as apostrophes or array notation), quotes can be omitted. Note that the value may also need shell quoting. The exact syntax depends on your shell. For example, to set `foo.bar` to the string "don't" in Bash, use `jj config set --user foo.bar '"don'\''t"'`. In Fish, use `jj config set --user foo.bar '"don\'t"'`. Alternatively, use `jj config edit` to edit the TOML file directly.

###### **Options:**

Expand Down

0 comments on commit f5fb73c

Please sign in to comment.