Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd1212a

Browse files
author
egberts
committed
Clarification README.md
1 parent 29c9e80 commit bd1212a

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

‎README.md‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,27 @@ Treats a no-section (any `keyword=keyvalue` before a `[section]`) as a '`[Defaul
1717

1818
Also correctly finds the last keyvalue of the desired section/keyword before extracting its keyvalue, despite its multiply-defined/multiple-reused interspersed/alternating section blocks.
1919

20+
Details
21+
=======
22+
23+
File format: .INI
24+
Supported version: 1.4 (2009)
25+
26+
Features
27+
----
28+
Currently supported features are:
29+
30+
* loads all settings into a multi-line bash string (no need for variable array)
31+
* Treats no-section as '`[Default]`'; reads both sections together as Default.
32+
* Check the section name and keyword name for valid character set.
33+
* Nested quotes also works alongside with inline comment (except for '//' inline comment support)
34+
* Supports and ignores inline comment using semicolon '`;`', hashmark '`#`'; But the double-slash '`//`' regex has been properly defined but not yet integrated as `bash` yet. See [Issue 1](https://github.com/egberts/bash-ini-file/issues/1).
35+
* Some 30,000 keyvalue lookups per second, no it is more like 20/second; well, like performance really matters here anyway.
36+
2037
HOW I DID THIS
2138
==============
2239

23-
The secret sauce is to convert the entire INI file into a parsable syntax format with one `awk`:
40+
The secret sauce is to convert the entire INI file into a parsable syntax format just with this one `awk` programming:
2441

2542
```awk
2643
/^\[.*\]$/{obj=0ドル}/=/{print obj 0ドル}'
@@ -55,12 +72,14 @@ get turned into this:
5572
[Default]FirstDefaultKeyword=1
5673
```
5774

58-
Parsable AWK/SED/GREP Galore!
75+
Note: Notice that we treated the 'no-section' as `[Default]`?
76+
77+
Parsable Galore!
5978
=======
60-
With a common `[section]keyword=keyvalue`, it now becomes possible to work with INI line-records in a faster manner using `sed`, `awk` and `tail`.
79+
With the usage of a common `[section]keyword=keyvalue` format, it now becomes easily possible to work with INI line-records in a faster manner using `sed`, `awk` and `tail` or even `grep`.
6180

6281

63-
How To Use bash-ini-parser
82+
APIs, APIs, Lots of API; well, just a few.
6483
====
6584
Simply source the lone script file: `bash-ini-parser.sh`
6685
and start calling APIs such as:
@@ -78,21 +97,6 @@ and start calling APIs such as:
7897
| `ini_keyvalue_get` | `-` | multi-line | Get the key value based on given section name and keyword name (most useful with `systemd`, `NetworkManager`. |
7998
| `ini_keyvalue_get_last` | `-` | string | Get the LAST key value encountered given a section name and a keyword name. (most useful if only interested by matched keyword for the last `keyword=keyvalue` to obtain its overridden keyvalue. |
8099

81-
Details
82-
=======
83-
84-
File format: .INI
85-
Supported version: 1.4 (2009)
86-
87-
Features:
88-
89-
* Supports and ignores inline comment using semicolon '`;`', hashmark '`#`'; But the double-slash '`//`' regex has been properly defined but not yet integrated as `bash` yet. See [Issue 1](https://github.com/egberts/bash-ini-file/issues/1).
90-
* loads all settings into bash string (no variable array)
91-
* Treats no-section as '`[Default]`'; reads both sections together as one.
92-
* Check the section name and keyword name for valid character set.
93-
* Nested quotes also works alongside with inline comment (except for '//' inline comment support)
94-
* 30,000 keyvalue lookup per second. (well, like performance really matters here anyway)
95-
96100
Demo
97101
====
98102
A nice bash script can be either my `example-usage.sh` script or below:
@@ -133,7 +137,7 @@ Unit Test
133137
=========
134138
The accompanied `tests` subdirectory performs the comprehensive unit testing, in case you have decided to tweaked it to your normative scenario; hopefully, this will find any errors of yours.
135139

136-
To exercise the test, your modified `bash-ini-parser.sh must reside above the `tests` directory as all the unit tests will perform:
140+
To exercise a specific unit test, your modified `bash-ini-parser.sh` must reside above the `tests` directory as all the unit tests will perform and find your modified script 'above':
137141

138142
```bash
139143
#!/bin/bash

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /