Browse Source

Add lssect to list all sections from mkit.ini

Alois Mahdal 7 years ago
parent
commit
b6452cd988
1 changed files with 9 additions and 0 deletions
  1. 9
    0
      src/include/ini.sh

+ 9
- 0
src/include/ini.sh View File

@@ -93,6 +93,14 @@ __ini_lskeys() {
93 93
     __ini_grepsec "$sct" | cut -d= -f1 | awk '!x[$0]++'
94 94
 }
95 95
 
96
+__ini_lssect() {
97
+    #
98
+    # List all section names
99
+    #
100
+    local arg=$1    # unused argument
101
+    grep -x '\[.*\]' | sed 's/^.//; s/.$//'
102
+}
103
+
96 104
 __ini_maybe_expand() {
97 105
     #
98 106
     # Decide whether or not to expand
@@ -114,6 +122,7 @@ ini() {
114 122
     local limit=__ini_cat    # limiting internal function
115 123
     case $op in
116 124
         lskeys) fn=__ini_lskeys   ;;
125
+        lssect) fn=__ini_lssect   ;;
117 126
         sec)    fn=__ini_grepsec  ;;
118 127
         values) fn=__ini_greppath ;;
119 128
         1value) fn=__ini_greppath; limit="tail -1" ;;