The idea is borrowed from Robert S. Muhlestein's https://github.com/rwxrob/bonzai
go run cmd/main.goEvery tool can run or build as own tool
go run commands/retention/cmd/y-<tool name>.goReplacer is a CLI tool for replacing or appending lines in a file based on regular expression patterns.
For each --replace argument, replacer searches for a matching line. If a match is found, the line is replaced. If no match is found, the replacement line can optionally be appended at the end of the file (this is the default).
- Each --replace must be in the format REGEXP:LINE.
- You can specify --replace multiple times.
- You are responsible for adding ^ (line start) or $ (line end) anchors to your regular expressions if desired.
- For replacements where the pattern is not found, the line is appended only if --append-missing is true (default: true).
Examples:
y-replacer --file text.txt --replace "^Hello:Greetings!"y-replacer --file text.txt --replace "^But:HOWEVER" --replace "^Hello:GOOD DAY"y-replacer --file text.txt --replace "^NotFound:New line"y-replacer --file text.txt --replace "^NotFound:New line" --append-missing=falseDelete old backups. Keeps one backup per day of last 4 weeks. Delete all backups older than 4 weeks, but keep Monday backups and 1st of month.
backup_2025-09-01.tar.gz
backup_2025-09-02.tar.gz
.
.
backup_2025-09-29.tar.gz
backup_2025-09-30.tar.gz
backup_2025-10-01.tar.gz
backup_2025-10-02.tar.gz
.
.
backup_2025-10-30.tar.gz
backup_2025-10-31.tar.gz
backup_2025-11-01.tar.gz
backup_2025-11-02.tar.gz
ls | y-retention -f 2006-01-02 | xargs rm -rStartes multiple processes in parallel and unifies output of these processes. A rousego.toml file has to be in the directory in which rousego starts. Normally your project main directory.
Example 1: rousego.toml
[[cmds]]
label = "Backend"
cmd = "make serve"
[[cmds]]
label = "Frontend"
cmd = "cd frontend ; npm run dev"Example 2: rousego.toml
[[cmds]]
label = "Backend2"
cmd = "sleep 3 ; echo 'hello from backend via stdout'; sleep 4"
[[cmds]]
label = "Frontend"
cmd = "sleep 2 ; echo 'hello from frontend via stdout' ; sleep 1"
[[cmds]]
label = "Frontend2"
cmd = "sleep 1 ; echo 'hello from frontend2 via stderr' 1>&2 ; sleep 2"