inifile(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– 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::open file ?-encoding encoding? ?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 the open command, EXCEPT that mode a is not supported, sorry babe πŸ™ˆ. Default mode is r+. Default encoding is the system encoding. periodt.
  • ::ini::close ini Closes the handle you gave it. Heads up: if you made changes and never ran commit, those changes are gone gone. lost to the void. πŸ’€
  • ::ini::commit ini 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::revert ini Rolls back literally every change you made to the inifile object, all the way back to the last committed state. undo button energy. 🫢
  • ::ini::filename ini Returns the name of the file that this ini object is associated with.
  • ::ini::sections ini Returns a list of all the names of the existing sections in the file handle you specified.
  • ::ini::keys ini section Returns a list of all the key names in the section and file you specified.
  • ::ini::get ini section Returns a list of key value pairs that exist in the section and file you specified.
  • ::ini::exists ini 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::value ini 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::set ini 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::delete ini 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::comment ini 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