# crudini - A utility for manipulating ini files
## Usage:
```
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]
SECTION can be empty ("") or "DEFAULT" in which case,
params not in a section, i.e. global parameters are operated on.
If 'DEFAULT' is used with --set, an explicit [DEFAULT] section is added.
Multiple --set|--del|--get operations for a config_file can be specified.
```
## Options:
```
--existing[=WHAT] For --set, --del and --merge, fail if item is missing,
where WHAT is 'file', 'section', or 'param',
or if WHAT not specified; all specified items.
--format=FMT For --get, select the output FMT.
Formats are 'sh','ini','lines'
--ini-options=OPT Set options for handling ini files. Options are:
'nospace': use format name=value not name = value
'ignoreindent': ignore leading whitespace
--inplace Lock and write files in place.
This is not atomic but has less restrictions
than the default replacement method.
--list For --set and --del, update a list (set) of values
--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
--verbose Indicate on stderr if changes were made
--help Write this help to stdout
--version Write version to stdout
```
## Examples:
```
# 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
# Read indented ini file, like .gitconfig
crudini --ini-options=ignoreindent --format=lines --get ~/.gitconfig
```
## Installation
On windows ensure a python interpreter is installed.
For example installing from https://www.python.org/downloads/
will put the py launcher and pip in the PATH.
Then ensure the iniparse module is installed by
running the following from a "cmd" prompt:
```
pip install iniparse
```
Then crudini can be invoked by downloading just the crudini.py
file and running like:
```
py crudini.py --help
```
On Linux systems crudini is generally available from your standard
package manager, and installing will also ensure the iniparse
dependency is appropriately installed on your system.
You can also download and run the single crudini.py file directly
to use latest version.
Raw data
{
"_id": null,
"home_page": "http://github.com/pixelb/crudini",
"name": "crudini",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ini,config,edit",
"author": "P\u00e1draig Brady",
"author_email": "P@draigBrady.com",
"download_url": "https://files.pythonhosted.org/packages/32/67/c4e838930e2f434db08d6a6aadffca3d14e7455d1c2c2332e22003ad453d/crudini-0.9.5.tar.gz",
"platform": null,
"description": "# crudini - A utility for manipulating ini files\n\n## Usage:\n```\ncrudini --set [OPTION]... config_file section [param] [value]\ncrudini --get [OPTION]... config_file [section] [param]\ncrudini --del [OPTION]... config_file section [param] [list value]\ncrudini --merge [OPTION]... config_file [section]\n\nSECTION can be empty (\"\") or \"DEFAULT\" in which case,\nparams not in a section, i.e. global parameters are operated on.\nIf 'DEFAULT' is used with --set, an explicit [DEFAULT] section is added.\n\nMultiple --set|--del|--get operations for a config_file can be specified.\n\n```\n## Options:\n```\n\n --existing[=WHAT] For --set, --del and --merge, fail if item is missing,\n where WHAT is 'file', 'section', or 'param',\n or if WHAT not specified; all specified items.\n --format=FMT For --get, select the output FMT.\n Formats are 'sh','ini','lines'\n --ini-options=OPT Set options for handling ini files. Options are:\n 'nospace': use format name=value not name = value\n 'ignoreindent': ignore leading whitespace\n --inplace Lock and write files in place.\n This is not atomic but has less restrictions\n than the default replacement method.\n --list For --set and --del, update a list (set) of values\n --list-sep=STR Delimit list values with \"STR\" instead of \" ,\".\n An empty STR means any whitespace is a delimiter.\n --output=FILE Write output to FILE instead. '-' means stdout\n --verbose Indicate on stderr if changes were made\n --help Write this help to stdout\n --version Write version to stdout\n\n```\n## Examples:\n```\n\n# Add/Update a var\n crudini --set config_file section parameter value\n\n# Add/Update a var in the root or global area.\n# I.e. that's not under a [section].\n crudini --set config_file \"\" parameter value\n\n# Update an existing var\n crudini --set --existing config_file section parameter value\n\n# Add/Update/Delete multiple variables atomically\n crudini --set config_file section parameter1 value \\\n --set config_file section parameter2 value \\\n --del config_file section parameter3\n\n# Get multiple items from stdin\n env | crudini --get - '' USER --get - '' SHELL\n\n# Add/Append a value to a comma separated list\n# Note any whitespace around commas is ignored\n crudini --set --list config_file section parameter a_value\n\n# Add/Append a value to a whitespace separated list\n# Note multiline lists are supported (as newline is whitespace)\n crudini --set --list --list-sep= config_file section parameter a_value\n\n# Delete a var\n crudini --del config_file section parameter\n\n# Delete a section\n crudini --del config_file section\n\n# output a value\n crudini --get config_file section parameter\n\n# output a global value not in a section\n crudini --get config_file \"\" parameter\n\n# output a section\n crudini --get config_file section\n\n# output a section, parseable by shell\n eval \"$(crudini --get --format=sh config_file section)\"\n\n# update an ini file from shell variable(s)\n echo name=\"$name\" | crudini --merge config_file section\n\n# merge an ini file from another ini\n crudini --merge config_file < another.ini\n\n# compare two ini files using standard UNIX text processing\n diff <(crudini --get --format=lines file1.ini|sort) \\\n <(crudini --get --format=lines file2.ini|sort)\n\n# Rewrite ini file to use name=value format rather than name = value\n crudini --ini-options=nospace --set config_file \"\"\n\n# Add/Update a var, ensuring complete file in name=value format\n crudini --ini-options=nospace --set config_file section parameter value\n\n# Read indented ini file, like .gitconfig\n crudini --ini-options=ignoreindent --format=lines --get ~/.gitconfig\n```\n## Installation\n\nOn windows ensure a python interpreter is installed.\nFor example installing from https://www.python.org/downloads/\nwill put the py launcher and pip in the PATH.\n\nThen ensure the iniparse module is installed by\nrunning the following from a \"cmd\" prompt:\n\n```\npip install iniparse\n```\n\nThen crudini can be invoked by downloading just the crudini.py\nfile and running like:\n\n```\npy crudini.py --help\n```\n\nOn Linux systems crudini is generally available from your standard\npackage manager, and installing will also ensure the iniparse\ndependency is appropriately installed on your system.\nYou can also download and run the single crudini.py file directly\nto use latest version.\n",
"bugtrack_url": null,
"license": "GPLv2",
"summary": "A utility for manipulating ini files",
"version": "0.9.5",
"project_urls": {
"Homepage": "http://github.com/pixelb/crudini"
},
"split_keywords": [
"ini",
"config",
"edit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c52be7e1ed429b1122c2c649c4b47b5f80efeea5d7531418a8bd1bd9f994ff16",
"md5": "d5b7bc8ca8da55ca0521859b0154f526",
"sha256": "84bc208dc7d89571bdc3c99274259d0b32d6b3a692d4255524f2eb4b64e9195c"
},
"downloads": -1,
"filename": "crudini-0.9.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "d5b7bc8ca8da55ca0521859b0154f526",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 23034,
"upload_time": "2023-10-04T10:21:51",
"upload_time_iso_8601": "2023-10-04T10:21:51.236413Z",
"url": "https://files.pythonhosted.org/packages/c5/2b/e7e1ed429b1122c2c649c4b47b5f80efeea5d7531418a8bd1bd9f994ff16/crudini-0.9.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3267c4e838930e2f434db08d6a6aadffca3d14e7455d1c2c2332e22003ad453d",
"md5": "65db5752000a9c95c35f0b047e670dcb",
"sha256": "59ae650f45af82a64afc33eb876909ee0c4888dc4e8711ef59731c1edfda5e24"
},
"downloads": -1,
"filename": "crudini-0.9.5.tar.gz",
"has_sig": false,
"md5_digest": "65db5752000a9c95c35f0b047e670dcb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 30991,
"upload_time": "2023-10-04T10:21:52",
"upload_time_iso_8601": "2023-10-04T10:21:52.870344Z",
"url": "https://files.pythonhosted.org/packages/32/67/c4e838930e2f434db08d6a6aadffca3d14e7455d1c2c2332e22003ad453d/crudini-0.9.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-04 10:21:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pixelb",
"github_project": "crudini",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"tox": true,
"lcname": "crudini"
}