A command-line tool to extract, normalize, and JSONify values from an iniherit-enabled "INI" file.
Project description
A command-line tool to extract, normalize, and JSONify values from an iniherit -enabled “INI” file.
Installation
$ pip install iniget
Usage
Given the following two files, base.ini:
[sect1]
foo = bar
and config.ini:
[DEFAULT]
%inherit = base.ini
The following will extract the inherited foo value:
$ iniget config.ini sect1 foo
bar
Much more is possible, including:
listing sections
listing options
JSON-encoding the configuration
JSON-interpreting option values
Control case-sensitivity, interpolation, and default values
Options
-s SECTION, --section SECTION
Specify additional sections to extract from; can be specified multiple times to add multiple sections.
-C, --no-case
Handle option names case insensitively.
-I, --no-inherit
Disable processing of “%inherit” directives.
-E, --no-expansion
Disable ConfigParser option expansion (“interpolation”).
-F, --no-fallback
Disables falling back to the raw option value when an option value cannot be interpolated (this generally happens when it is incorrectly formatted or it references undefined substitutions), and causes an exception to be thrown.
-K, --list-options
List the option names only, not the values.
-S, --list-sections
List the section names only.
-J, --json-parse
If option values are JSON-parseable, parse as such; additionally, the following are interpreted as boolean values: ‘yes’, ‘true’, ‘on’, ‘off’, ‘no’, ‘false’.
-j, --json-output
Render the output using JSON syntax.
-d JSON, --defaults JSON
Set the ConfigParser default values from this JSON-parsed dictionary.
-r, --raw
Don’t do anything fancy: show exactly what ConfigParser interprets (requires exactly one section and one option); note that options “–no-case”, “–no-inherit”, “–no-expansion” and “–defaults” are still honored, but “–json-parse” is not.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file iniget-0.4.3.tar.gz
.
File metadata
- Download URL: iniget-0.4.3.tar.gz
- Upload date:
- Size: 20.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/2.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00e725103fb72dc0f1734c990764c4bed6056db5897720e9241e5ee5f5ac83c2 |
|
MD5 | 0e5ca8127b8ec2daace438e8cc8bd5f0 |
|
BLAKE2b-256 | ddd9616045c342f2afcad8115f98d0b0d89b7d85a22f69d70f2a318927ccff1e |