digitalocean/exec-sanitize

forked from kamaln7/exec-sanitize

Open original ↗

Captured source

source ↗
published Nov 6, 2024seen 5dcaptured 15hhttp 200method plain

digitalocean/exec-sanitize

Language: Go

Stars: 0

Forks: 0

Open issues: 0

Created: 2024-11-06T16:35:02Z

Pushed: 2024-11-06T16:53:55Z

Default branch: main

Fork: yes

Parent repository: kamaln7/exec-sanitize

Archived: no

README:

🌶 exec-sanitize

pass-through execute a command while sanitizing its output. regex or plaintext patterns can be replaced with pre-defined strings. an optional logging dir may be used to store the original values.

$ echo "Hi, welcome to Chili's. Bye."

Hi, welcome to Chili's. Bye.
$ exec-sanitize \
-p:regex '(Hi|Bye)' \
-r '' \
-p:plain '.*welcome to' \
-r 'you have arrived at' \
-log /tmp/log \
-- \
bash -c "echo \"Hi, .*welcome to Chili's. Bye.\""

, you have arrived at Chili's. .

with /tmp/log containing the files:

  • 0: Hi
  • 1: Bye
  • 2: .*welcome to

---

usage: exec-sanitize -- [args...]

each pattern must be directly followed with replacement. a replacement value of "@discard" deletes the line entirely.

-log value
optional directory to log substituted strings as numbered files. if set, replacements will have the first asterisk * replaced with the log item number
-p:regex value
regexp pattern to sanitize.
-p:plain value
plaintext pattern to sanitize.
-r value
what to replace matched substrings with.

Excerpt shown — open the source for the full document.

Notability

notability 2.0/10

Routine fork, no notable traction