Review Request 109892: introduce "kconfig" as replacement for kreadconfig and kwriteconfig

Thomas Lübking thomas.luebking at gmail.com
Sun Apr 13 13:58:14 BST 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/109892/
-----------------------------------------------------------

(Updated April 13, 2014, 12:58 p.m.)


Status
------

This change has been discarded.


Review request for KDE Runtime.


Repository: kde-runtime


Description
-------

A CLI config tool.

It supports reading and writing of config entries.

Features beyond kread/writeconfig:
----------------------------------
- regular expression matching
- key/group deletion
- regexp based (mass) replacement
- regexp based entry listing

Usecases:
---------
a) kconfupdates:
Whenever you've got legacy settings and you need to update them you end up either writing a cpp blackbox (to the user) or a complex ('bash' != 'sh' ...) and slow script for it (latter sometimes not even being possible - original reason to write this ;-)

b) user assistance:
it is much simpler to ask a user to "kreadconfig --file kwinrc --group Compositing --key MaxFPS" than to explain the clickchain through the config GUI.
If you need more than one key, regexp driven maybe grouplisting can be very convenient.

c) key deletion:
right now the tool of choice for that is called "kwrite" ...


Syntax:
-------
kconfig <component>[/<group>[/<subgroup>[...]]] read|write|delete|list|replace [<key>] [<value>]


Examples: (to get you an idea)
---------

Let's say you want to show the configured MaxFPS of the compositor
$ kconfig kwinrc/Compositing read MaxFPS
  MaxFPS: 60 (kwinrc/Compositing)

Unset it:
$ kconfig kwinrc/Compositing delete MaxFPS   
  Removed MaxFPS: 60

Add it:
$ kconfig kwinrc/Compositing write MaxFPS 60
  New MaxFPS: 60

You got a 120Hz screen and want the compositor tick more?
$ kconfig kwinrc/Compositing write MaxFPS 120
  MaxFPS: 60 -> 120

You forgot the actual key?
$ kconfig kwinrc/Compositing list max
  MaxFPS: 120

Isn't there too much output for script invocation? (No)
$ MAX_FPS=`kconfig kwinrc/Compositing read MaxFPS`; echo $MAX_FPS
  120

You want to alter a present MaxFPS key to MaxFps?
$ kconfig kwinrc/Compositing replace 'MaxFPS=(.*)' 'MaxFps=\1'
  MaxFPS: 120 -> MaxFps: 120

List all electric borders - w/o knowing in what group they are:
$ kconfig 'kwinrc/.*' list electric


Diffs
-----

  kreadconfig/CMakeLists.txt c73c9ac 
  kreadconfig/Messages.sh 55b886c 
  kreadconfig/kconfig.cpp PRE-CREATION 

Diff: https://git.reviewboard.kde.org/r/109892/diff/


Testing
-------


Thanks,

Thomas Lübking

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20140413/0eb27913/attachment.htm>


More information about the kde-core-devel mailing list