1CRUDINI(1)                       User Commands                      CRUDINI(1)
2
3
4

NAME

6       crudini - manipulate ini files
7

SYNOPSIS

9       crudini --set [OPTION]...   config_file section   [param] [value]
10       crudini --get [OPTION]...   config_file [section] [param]
11       crudini --del [OPTION]...   config_file section   [param] [list value]
12       crudini --merge [OPTION]... config_file [section]
13

DESCRIPTION

15       crudini - A utility for manipulating ini files
16
17       SECTION  can  be empty ("") or "DEFAULT" in which case, params not in a
18       section, i.e. global parameters are operated on.  If 'DEFAULT' is  used
19       with --set, an explicit [DEFAULT] section is added.
20
21       Multiple  --set|--del|--get  operations for a config_file can be speci‐
22       fied.
23

OPTIONS

25       --existing[=WHAT]
26              For --set, --del and --merge, fail if  item  is  missing,  where
27              WHAT is 'file', 'section', or 'param', or if WHAT not specified;
28              all specified items.
29
30       --format=FMT
31              For   --get,   select   the    output    FMT.     Formats    are
32              'sh','ini','lines'
33
34       --ini-options=OPT
35              Set options for handling ini files.  Options are: 'nospace': use
36              format name=value not name = value 'ignoreindent': ignore  lead‐
37              ing whitespace
38
39       --inplace
40              Lock  and write files in place.  This is not atomic but has less
41              restrictions than the default replacement method.
42
43       --list For --set and --del, update a list (set) of values
44
45       --list-sep=STR
46              Delimit list values with "STR" instead of " ,".   An  empty  STR
47              means any whitespace is a delimiter.
48
49       --output=FILE
50              Write output to FILE instead. '-' means stdout
51
52       --verbose
53              Indicate on stderr if changes were made
54
55       --help Write this help to stdout
56
57       --version
58              Write version to stdout
59

EXAMPLES

61       # Add/Update a var
62
63              crudini --set config_file section parameter value
64
65       # Add/Update a var in the root or global area.  # I.e. that's not under
66       a [section].
67
68              crudini --set config_file "" parameter value
69
70       # Update an existing var
71
72              crudini --set --existing config_file section parameter value
73
74       # Add/Update/Delete multiple variables atomically
75
76              crudini --set config_file section parameter1 value \
77
78       --set config_file section parameter2 value \
79
80       --del config_file section parameter3
81
82       # Get multiple items from stdin
83
84              env | crudini --get - '' USER --get - '' SHELL
85
86       # Add/Append a value to a comma separated list #  Note  any  whitespace
87       around commas is ignored
88
89              crudini --set --list config_file section parameter a_value
90
91       #  Add/Append  a  value to a whitespace separated list # Note multiline
92       lists are supported (as newline is whitespace)
93
94              crudini --set --list --list-sep= config_file  section  parameter
95              a_value
96
97       # Delete a var
98
99              crudini --del config_file section parameter
100
101       # Delete a section
102
103              crudini --del config_file section
104
105       # output a value
106
107              crudini --get config_file section parameter
108
109       # output a global value not in a section
110
111              crudini --get config_file "" parameter
112
113       # output a section
114
115              crudini --get config_file section
116
117       # output a section, parseable by shell
118
119              eval "$(crudini --get --format=sh config_file section)"
120
121       # update an ini file from shell variable(s)
122
123              echo name="$name" | crudini --merge config_file section
124
125       # merge an ini file from another ini
126
127              crudini --merge config_file < another.ini
128
129       # compare two ini files using standard UNIX text processing
130
131              diff <(crudini --get --format=lines file1.ini|sort) \
132
133              <(crudini --get --format=lines file2.ini|sort)
134
135       # Rewrite ini file to use name=value format rather than name = value
136
137              crudini --ini-options=nospace --set config_file ""
138
139       # Add/Update a var, ensuring complete file in name=value format
140
141              crudini  --ini-options=nospace --set config_file section parame‐
142              ter value
143
144       # Read indented ini file, like .gitconfig
145
146              crudini --ini-options=ignoreindent --format=lines --get  ~/.git‐
147              config
148
149
150
151crudini 0.9.5                    October 2023                       CRUDINI(1)
Impressum