CRUDINI(1)

πŸ“¦
version 0.9.6 Β· 5 versions
, in debian trixie, epel 10, epel 9, fedora 43, fedora 44, ubuntu questing

πŸ’– CRUDINI β€” bestie's guide to manipulating ini files πŸ’–

okay so like. hi. you're looking at the crudini(1) page from the User Commands manual, and honestly? this little tool is a whole icon and you're about to be obsessed. it does one job: it manipulates ini files. that's it. that's the girl. and it does it so well. periodt. πŸŽ€


✨ NAME ✨

crudini β€” manipulate ini files


πŸ¦‹ SYNOPSIS πŸ¦‹

crudini --set [OPTION]...   config_file section   [param] [value]
crudini --get [OPTION]...   config_file [section] [param]
crudini --del [OPTION]...   config_file section   [param] [list value]
crudini --merge [OPTION]... config_file [section]

🌸 DESCRIPTION 🌸

crudini β€” a utility for manipulating ini files. no cap, that's the whole pitch. πŸ’…

okay so the big one: SECTION can be empty ("") or "DEFAULT". when that happens, you're operating on params that aren't in a section β€” i.e. the global parameters. and heads up bestie, if you use 'DEFAULT' together with --set, an explicit [DEFAULT] section gets added. noted. 🫢

also very slay: you can specify multiple --set/--del/--get operations for a single config_file. like, one invocation, many vibes. πŸ”₯


πŸ‘‘ OPTIONS πŸ‘‘

  • --existing[=WHAT] β€” for --set, --del and --merge: fail if the item is missing. WHAT can be 'file', 'section', or 'param'. if you don't specify WHAT, it means all specified items. lowkey strict, highkey useful. πŸ’€
  • --format=FMT β€” for --get, pick the output FMT. the formats are 'sh', 'ini', 'lines'. pick your fighter. ✨
  • --ini-options=OPT β€” set options for how ini files get handled. the options are:
    • 'nospace': use the format name=value, not name = value
    • 'space': ensure the name = value format
    • 'sectionspace': ensure one blank line between sections
    • 'ignoreindent': ignore leading whitespace
  • --inplace β€” lock and write files in place. > this is not atomic, but it has fewer restrictions than the default replacement method. so like… know what you're doing, bestie. πŸ™ˆ
  • --list β€” for --set and --del, update a list (set) of values. yes, a whole set. main character energy. 🌈
  • --list-sep=STR β€” delimit list values with "STR" instead of " ,". an empty STR means any whitespace is a delimiter. πŸ“
  • --output=FILE β€” write output to FILE instead. '-' means stdout. iconic.
  • --verbose β€” indicate on stderr if changes were made. she's chatty and we love that. πŸ’œ
  • --help β€” write this help to stdout. πŸ“–
  • --version β€” write version to stdout. ⭐

🌟 EXAMPLES 🌟

okay this is the fun part. let's go. 🧚

# Add/Update a var

crudini --set config_file section parameter value

# Add/Update a var in the root or global area. # I.e. that's not under a [section].

crudini --set config_file "" parameter value

# Update an existing var

crudini --set --existing config_file section parameter value

# Add/Update/Delete multiple variables atomically

crudini --set config_file section parameter1 value \

--set config_file section parameter2 value \

--del config_file section parameter3

# Get multiple items from stdin

env | crudini --get - '' USER --get - '' SHELL

# Add/Append a value to a comma separated list # Note any whitespace around commas is ignored

crudini --set --list config_file section parameter a_value

# Add/Append a value to a whitespace separated list # Note multiline lists are supported (as newline is whitespace)

crudini --set --list --list-sep= config_file section parameter
a_value

# Delete a var

crudini --del config_file section parameter

# Delete a section

crudini --del config_file section

# output a value

crudini --get config_file section parameter

# output a global value not in a section

crudini --get config_file "" parameter

# output a section

crudini --get config_file section

# output a section, parseable by shell

eval "$(crudini --get --format=sh config_file section)"

# update an ini file from shell variable(s)

echo name="$name" | crudini --merge config_file section

# merge an ini file from another ini

crudini --merge config_file < another.ini

# compare two ini files using standard UNIX text processing

diff <(crudini --get --format=lines file1.ini|sort) \

<(crudini --get --format=lines file2.ini|sort)

# Rewrite ini file to use name=value format rather than name = value

crudini --ini-options=nospace --set config_file ""

# Add/Update a var, ensuring complete file in name=value format

crudini --ini-options=nospace --set config_file section parameter
value

# Rewrite ini file to ensure a single blank line between sections, # and no leading or trailing blank lines

crudini --ini-options=sectionspace --set config_file ""

# Read indented ini file, like .gitconfig

crudini --ini-options=ignoreindent --format=lines --get
~/.gitconfig

and that's the whole page, bestie!! 🫢 this one's crudini 0.9.6, dated April 2025, and it came to you straight from the CRUDINI(1) manual. go forth and manipulate those ini files, you absolute legend. mwah. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…

πŸ“¦ where this page comes from