TOMCLI-SET-ARRAYS(1)

πŸ“¦
version 0.10.1 Β· 4 versions
, in fedora 43

πŸ’– TOMCLI-SET-ARRAYS πŸ’–

okay bestie, so this is the tomcli-set arrays situation, and it lives in the General Commands Manual for tomcli-set. It's the CLI for working with TOML files. And yes, it's pronounced "tom clee." β€” that's canon, we don't argue about it. πŸŽ€


✨ SYNOPSIS ✨

[tomcli-set | tomcli set] [GLOBAL OPTIONS] PATH arrays COMMAND [OPTIONS]
[ARGUMENTS]

[tomcli-set | tomcli set] ... arrays [COMMAND] --help

🌸 DESCRIPTION 🌸

The tomcli-set arrays subcommand is literally the whole vibe for modifying arrays in TOML files. That's its job. It does it well. πŸ’…

Now, tea time: tomcli-set lists still exists as an alias, kept around for backwards compatibility. But arrays is the preferred one, because it follows the TOML spec's terminology and we respect the spec in this house. 🫢

And before anyone panics: there are no plans to remove the lists subcommand. Backwards compatibility is important to the tomcli project. So your old scripts are safe, periodt.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • PATH β€” Path to a TOML file to read. Use '-' to read from stdin. Set it to ... when you're calling --help for a subcommand.
  • SELECTOR β€” A dot separated map to a key in the TOML mapping. Like:
Example: 'section1.subsection.value' or '"key.with.dots".abc'
  • VALUE β€” Value to set.
  • PATTERN β€” Pattern against which to match strings. Defaults to regex but can be changed with the --type option. The pattern must match the full string.
  • REPL β€” Replacement string (used by the replace subcommand). Supports Python regex expansions (e.g. \1) when --type is set to regex (i.e., the default value). ✨

🌈 GLOBAL OPTIONS 🌈

  • --version β€” Show the version and exit. Slay.
  • --writer <tomli_w|tomlkit> β€” Library to use to write TOML files.
  • --reader <tomli|tomlkit> β€” Library to use to write TOML files. Defaults to tomlkit and falls back to tomli/tomllib if tomlkit is unavailable.

πŸ’œ OPTIONS πŸ’œ

  • -t / --type <regex_fullmatch|regex|regex_partial|fnmatch> (default: regex_fullmatch) β€” Matcher type. Here's the breakdown, bestie:
    • regex_fullmatch: Equivalent to re.fullmatch in Python. The regex must match the whole string.
    • regex: Alias for regex_fullmatch
    • regex_partial: Equivalent to re.match in Python. The regex matching starts at the beginning of the string but does not have to match all of it.
    • regex_search: Equivalent to re.search / re.sub (with count=1) in Python. The regex can match any part of the string, once.
    • fnmatch: Use an fnmatch(3)-style pattern. The glob must match the whole string.
  • --first / --no-first (default: no-first) β€” Only modify the first PATTERN match. 🎯
  • --key <SELECTOR PATTERN> β€” Only applies to the delitem subcommand. See the delitem documentation below. πŸ‘€

πŸ‘‘ COMMANDS πŸ‘‘

πŸ“ append

Add a string value to a TOML array.

tomcli-set [GLOBAL OPTIONS] PATH arrays append [OPTIONS] SELECTOR VALUE
tomcli-set ... arrays append --help

πŸ’€ delitem

Delete string values in a TOML array. SELECTOR matches the path to the array and PATTERN matches strings within the array that should be deleted. Items that are not a string will be ignored. πŸ™ˆ

The --key option be used to remove values from an array that contains tables (i.e., key-value pairs) instead of strings. Then, the KEY selector is looked up in each table and the respective value is matched against PATTERN. See https://todo.sr.ht/~gotmax23/tomcli/9 for a more detailed description and rationale.

tomcli-set [GLOBAL OPTIONS] PATH arrays delitem [OPTIONS] SELECTOR PATTERN
tomcli-set ... arrays delitem --help

🧚 replace

Replace string values in a TOML list with other string values.

tomcli-set [GLOBAL OPTIONS] PATH arrays replace [OPTIONS] SELECTOR PATTERN REPL
tomcli-set ... arrays replace --help

⭐ str

Create a TOML list of strings.

tomcli-set [GLOBAL OPTIONS] PATH arrays str [VALUE...]
tomcli-set ... arrays str --help

πŸ”₯ SEE ALSO πŸ”₯

tomcli(1), tomcli-formatters(1), tomcli-set(1), tomcli-set(1)


ngl, that's the whole page. go forth and modify some arrays, bestie πŸ’–

This was TOMCLI-SET-ARRAYS(1), from the General Commands Manual, dated 2025-09-19. main character energy, no cap. πŸŽ€βœ¨

πŸ“¦ where this page comes from