Closed jirib closed 1 year ago
Closing this as a duplicate of issue #86
now implemented
@pixelb unfortunately, it's not working for me; btw, the test in the commit does not cover multiple --get
iiuc.
$ crudini --version
crudini 0.9.4
$ diff -uNp \
<(curl -Ls 'https://raw.githubusercontent.com/pixelb/crudini/master/crudini.py') \
$(command -v crudini) ; echo $?
0
$ out="$(sed -n '/global.ini$/,/^#==/{/^#==/q;p}' scc_mdxhte01_230918_1931/plugin-ha_sap.txt)"
# showing the content...
$ head <<< "${out}"
# /usr/sap/HTE/SYS/global/hdb/custom/config/global.ini
[communication]
sslclientpki = off
sslminprotocolversion = TLS10
listeninterface = .global
[cross_database_access]
targets_for_systemdb = HTE
enabled = true
[expensive_statement]
enable = true
$ crudini --format=lines \
--get <(echo "${out}") communication \
--get <(echo "${out}") cross_database_access \
--get <(echo "${out}") expensive_statement
Can't operate on multiple files
A utility for manipulating ini files
Usage: crudini --set [OPTION]... config_file section [param] [value]
or: crudini --get [OPTION]... config_file [section] [param]
or: crudini --del [OPTION]... config_file section [param] [list value]
or: 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
--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
@jirib In your example, multiple input "files" are created by the shell. Instead your use case should be supported like:
echo "${out}" |
crudini --format=lines \
--get - communication \
--get - cross_database_access \
--get - expensive_statement
@jirib In your example, multiple input "files" are created by the shell. Instead your use case should be supported like:
echo "${out}" | crudini --format=lines \ --get - communication \ --get - cross_database_access \ --get - expensive_statement
This works. Thank you very much.
It would be great if one could
get
multiple sections, or multiple specific parameters with one call ofcrudini
. Thank you.