fgtk toolkit
A set of a basic tools for files' and their contents' manipulation.Right now it consists of two sets - py-prefixed unixish tools for content manipulation and a "scim" toolset, intended for scm-enabled configuration management.
Files
- scim set
A set of tools to bind a bunch of scattered files to a single path, with completely unrelated internal path structure. Intended usage is to link configuration files to scm-controlled path (repository).
Actually started as cfgit project, but lately evolved away from git vcs into a more generic, not necessarily vcs-related, solution. - scim-ln
Adds a new link (symlink or catref) to a manifest (links-list), also moving file to scim-tree (repository) on fs-level. - scim
Main tool to check binding and metadata of files under scim-tree. Basic operation boils down to two (optional) steps:- Check files' metadata (uid, gid, mode, acl, posix capabilities) against metadata-list (.scim_meta, by default), if any, updating the metadata/list if requested, except for exclusion-patterns (.scim_meta_exclude).
- Check tree against links-list (.scim_links), warning about any files / paths in the same root, which aren't on the list, yet not in exclusion patterns (.scim_links_exclude).
Content
- pysed
This one is for simple text replacement. Awk, sed and co are fine, but their extended regex syntax is horrible and quite restrictive, compared to PCRE, and I've always dreaded performing any complex regex-based manipulations with these. All the escapes', [[:whatever:]] classes, state-of-art ambiguity... brrr.
PCRE, on the other hand, look quite natural to me and I tend to use them in (py) code quite often.
Added benefit is no ugly 's|foo|bar|' syntax with additional escaping.
Example, to replace all two-space indents with tabs and drop stupid space-based inline alignment:pysed '(?<=\w)\s+(?=\w)' ' ' '^\s* ' '\t' -i10 -b somecode.py
- pysort
Sort file contents, based on some key-field with support for multiple field delimeters.
Wrote this one when my /etc/passwd got messy and I just wanted to sort its contents by uid. - pyseek
Simple tool to read some arbitrary chunk of a file. - fs
Complex tool for high-level fs operations. Reference is built-in.
Copy contents (w/o touching the attrs):fs cc /file1 /file2
Copy contents, reversing args:fs --reverse cc /file1 /file2
Copy files, setting mode and ownership for the destination:fs -m600 -o root:wheel cp * /somepath
Temporarily (1hr) change attributes (i.e. to edit file from user's editor):fs -t3600 -m600 -o someuser expose /path/to/file
Copy ownership/mode from one file to the other:fs cps /file1 /file2