Sunday, December 19, 2010

gnocl::keyFile almost done

After this morning's coding session the package now has functionality to change values and write these changes to disk.  The next step is implementing some of the introspection functionality and its pretty-well complete.

Here's the test script updated to reflect changes:

#---------------
# test-keyfile.tcl
#---------------
# William J Giddings, 28/12/2010
#---------------

#!/bin/sh
#\
exec tclsh "$0" "$@"

package require Gnocl

# 18/12/10 Additions
set kf1 [gnocl::keyFile load sample_config.ini]

puts "1 [$kf1 get value -group Person -key name]"
puts "2 [$kf1 get value -key name -group Person ]"
puts "3 [$kf1 get value -group Person -key name]"
puts "4 [$kf1 get value -key name -group Person ]"
puts "5 [$kf1 get integer -key age -group Person ]"
puts "6 [$kf1 get value -key sex -group Person ]"
puts "6 [$kf1 get value -key sex -group Person -locale UK ]"
puts "7 [$kf1 get comment -group Person -key name ]"

# 19/12/10 Additions
$kf1 set comment -group Person -key name -value "HIDI HI, HO DI HO!! HEHE"
$kf1 write sample_config.ini

# Next sub-command to implement
puts >>[$kf1 get groups]



No comments: