SRCREDACT(1)

πŸ’– SRCREDACT(1) β€” the Text tools girly πŸ’–

okay bestie so this is the manual page for srcredact, from section 1 of the man pages (the Text tools girlies ✨). it redacts text files. yes. literally that. let's go 🫢


✨ NAME ✨

srcredact β€” a program for redaction of text files. she does one thing and she does it iconically πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

srcredact [OPTIONS] -e audience [full_file]

srcredact [OPTIONS] -u audience full_file [redacted_file]

srcredact -l [full_file]

srcredact -h|-v

πŸ¦‹ DESCRIPTION πŸ¦‹

so srcredact is THE program that either pulls redacted versions'' out of the master file (that's option `-e`, the extract vibe) or takes the changes you made in the redacted versions and shoves them back into the master file (that's the unredact'' girl, option -u). no cap. πŸ”₯

the master file is basically a bunch of chunks, and each chunk is meant for a different audience. every audience has a name, like "classified", "unclassified", "expert" etc. chunks get started and stopped by guard lines. each guard line has this format (this is for the default TeX syntax, keep up bestie):

%<*name1|name2|...>

or

%</name1|name2|...>

first case: everything after the guard is included for the audiences "name1", "name2", .... second case: it's excluded for those audiences. periodt. πŸ’œ

there's also a special audience called "ALL" β€” she's a wild card for literally every audience. so this idiom:

%</ALL>
%<*classified>

means the chunk is excluded for all audiences but "classified". main character energy tbh πŸ‘‘

exactly one of the options -e (extract) or -u (unextract) has to be present, okay? exactly one. not zero, not two. πŸ’€

in extract mode, the non-option argument is the name of the full file. if it's missing, or if it's "-", then standard input gets used. in the unextract mode the first non-option argument

yes bestie the sentence really does just end there in the original. the manpage said "and that's it, i'm done" 😭 iconic behavior honestly. moving on!!

🌸 OPTIONS 🌸

  • -c list of comment patterns β€” use the given pattern for comment lines when searching for guards, instead of the default "TeX" pattern. the recognized patterns are:
    • c
/*<guard>*/
  • cpp
//<guard>
  • fortran
C<guard>
  • shell
#<guard>
  • TeX
%<guard>

the pattern names should be separated by commas, and the list can be wrapped in quotes to stop the shell from doing shell expansion things to it, e.g.

-c "TeX, c, shell"
  • -d β€” debug mode on. we're snooping now πŸ”
  • -e audience β€” extract the contents for the current audience into the file file. the current audience gets guessed from the file name, if that name has the structure base-audience.extension, e.g. "report-unclassified.tex". the key -a overrides this guess and should be used if the file name does not follow this pattern. the file name "-" means standard output.
  • -h β€” print help information and exit. we love a girl who explains herself 🫢
  • -l β€” list all audiences set in the file (one per line) and exit. little lineup, so satisfying ✨
  • -u audience β€” take an edited file intended for the audience (that's the second non-option argument) and incorporate the changes in it into the full file (that's the first non-option argument). if the second argument is missing, standard input is used instead. as usual, "-" also means standard input. and note: only one of the two file arguments in this case can be standard input. not both. i don't make the rules, bestie πŸ’…
  • -v β€” print version information and exit. a little "who am i" moment πŸŽ€
  • -w on|off|1|0|true|false β€” if it's "on", 1 or "true" (the default), implicitly wrap the full document into the guards
%<*ALL>
...
%</ALL>

πŸ’œ RETURN VALUE πŸ’œ

the program returns 0 if everything went great, 1 if conflicts were found in the "unextract" mode, and 2 in case of problems. so like, zero is the slay, one is the drama, two is the crisis 😭


πŸ”₯ CONFLICTS IN UNEXTRACT MODE πŸ”₯

just like the standard diff3(1) tool, the program may find conflicts between the full version and the edited one in the -u mode. when that happens, the resulting file brackets the conflicts in the usual manner, e.g.

<<<<<<< /tmp/BrjXo0hMOB/full
%</nobonds>
Forty-five tons best old dry government bonds, suitable for furnace, gold
7 per cents., 1864, preferred.
%<*nobonds>
||||||| /tmp/BrjXo0hMOB/extracted
Forty-five tons best old dry government bonds, suitable for furnace, gold
7 per cents., 1864, preferred.
=======
>>>>>>> /tmp/BrjXo0hMOB/new

so here "full" is the full document, "extracted" is the extracted file for the given audience, and "new" is the edited file. three girlies, one conflict, we've all been there πŸ™ˆ


🌈 AUTHOR 🌈

Boris Veytsman, borisv@lk.net

this work was commissioned by Consumer Financial Protection Bureau, United States Treasury. (yes the actual US Treasury. she's employed-employed πŸ‘‘)


Copyright (C) 2015 Boris Veytsman. Version 1.0

this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

this program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details.

you should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA


okay that's the whole thing bestie, and this was version 1.0, dated 2015-10-24 β€” go forth and redact responsibly, mwah πŸ’‹βœ¨πŸ“