inifile(n)
π inifile β Parsing of Windows INI files π
okay bestie, welcome to inifile(n), the manual page for the inifile package β yes that's the manual name right there, and it's literally all about parsing Windows INI files π
β¨ NAME β¨
inifile β Parsing of Windows INI files
πΈ SYNOPSIS πΈ
package require Tcl 8.5 9
package require inifile ?0.3.3?
::ini::open file ?-encoding encoding? ?access?
::ini::close ini
::ini::commit ini
::ini::revert ini
::ini::filename ini
::ini::sections ini
::ini::keys ini section
::ini::get ini section
::ini::exists ini section ?key?
::ini::value ini section key ?default?
::ini::set ini section key value
::ini::delete ini section ?key?
::ini::comment ini section ?key? ?text?
::ini::commentchar ?char?
π¦ DESCRIPTION π¦
So this package is your little bestie for messing with Windows INI files β super easy, super chill, no cap. Here's the whole squad of commands π
::ini::openfile ?-encodingencoding? ?access? Opens an INI file and hands you back a handle β that's the thing all the other commands wanna see. access works exactly like the first form (the non POSIX one) of theopencommand, EXCEPT that modeais not supported, sorry babe π. Default mode isr+. Default encoding is the system encoding. periodt.::ini::closeini Closes the handle you gave it. Heads up: if you made changes and never rancommit, those changes are gone gone. lost to the void. π::ini::commitini Writes the file and every single change out to disk. The sections get written in arbitrary order (so don't come for me about the vibes) and the keys inside a section get written in alphabetical order. If the ini was opened in read only mode, an error gets thrown. no exceptions, bestie.::ini::revertini Rolls back literally every change you made to the inifile object, all the way back to the last committed state. undo button energy. π«Ά::ini::filenameini Returns the name of the file that this ini object is associated with.::ini::sectionsini Returns a list of all the names of the existing sections in the file handle you specified.::ini::keysini section Returns a list of all the key names in the section and file you specified.::ini::getini section Returns a list of key value pairs that exist in the section and file you specified.::ini::existsini section ?key? Returns a boolean value telling you whether the section exists as a whole, or whether that specific key exists inside that section.::ini::valueini section key ?default? Returns the value of the named key and section. If you pass a default, that's what you get back when the key doesn't exist. If the key doesn't exist and you gave no default? error. π::ini::setini section key value Sets the value of the key in the section you named. If that section doesn't exist yet, a brand new one gets created. main character energy β¨::ini::deleteini section ?key? Removes the key β or the entire section along with all its keys. And ngl, a section is not automatically deleted just because it has no keys left. It's still there. just vibing. empty.::ini::commentini section ?key? ?text? Reads and modifies comments for sections and keys. Wanna write a section comment? Use an empty string for the key. Wanna remove all the comments? Use an empty string for text. text can be a list of lines or one single line β and any embedded newlines in text are properly handled, we're not messy. You can write comments to nonexistent sections or keys and it will not return an error. Reading a comment from a nonexistent section or key returns an empty string. slay.::ini::commentchar?char? Reads and sets the comment character. Lines that begin with this character get treated as comments, and when comments are written out, each line gets preceded by this character. The default is;. π
π BUGS, IDEAS, FEEDBACK π
ngl, this document and the package it describes will undoubtedly contain bugs and other problems β it's giving very human of us. Please report them in the category inifile of the Tcllib Trackers at http://core.tcl.tk/tcllib/reportlist. And if you've got ideas for enhancements for the package and/or the documentation, send those too, we wanna hear it fr fr.
When you propose code changes, please provide unified diffs β that means the output of diff -u.
Also note: attachments are strongly preferred over inlined patches. You can make an attachment by going to the Edit form of the ticket immediately after creating it, and then using the left-most button in the secondary navigation bar. iykyk π§
π CATEGORY π
Text processing
and that's the whole page bestie π this was inifile(n) from tcllib, version 0.3.3, dated 0.3.3 β thanks for reading, go write some INI files, ily π«Άβ¨
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms