See output/input status of all sub-folders
Project description
coi: manage shell script templates for reuse
I often improvise bash scripts and later regret not saving them. This tool manages shell script templates for reuse.
- run shell command templates with substitutions
- keep track of commands run in each folder for later reference
- store common templates
00:46 nosarthur src$ coi run -c 'echo $f' -i '*' -t for-loop
cd /Users/nosarthur/src/
for f in *; do
echo $f
done
[q]uit [r]un: r
....
For example, the variable parts of the following batch execution may be
- folder name pattern:
*_5/
- command:
$ABIN/generate.py
for dname in *_5/; do python3 $ABIN/generate.py $dname${dname%/}-out.cms; done
After saving a template, we can rerun this command at current working directory with
coi run -i "*_5" -c "python3 $ABIN/generate.py"
commands
run
sub commandtemplates
sub commandcoi templates add <name>
coi templates add <name> -t <template-file>
coi templates edit <name>
coi templates ls
coi templates rm <name>
coi templates set <name>
coi templates show <name>
example
Suppose the folder structure
jobs-folder
├── sub1
│ ├── 1.input
│ ├── 1.output
│ └── 2.input
├── sub2
│ ├── 1.input
│ └── 2.input
├── sub3
│ ├── 1.input
│ ├── 1.output
│ ├── 2.input
│ └── 2.output
└── sub4
├── 1.input
└── 1.output
coi -c "wc -l" \
-o "ll *.output" \
-i "ll *.input" \
jobs-folder
sub1 (1 / 2)
sub2 (0 / 2)
sub3 (2 / 2)
sub4 (1 / 1)
customization
Python [template strings](https://docs.python.org/3/library/string.html#template-strings ])
design
Essentially this is a tool for shell script templating, with up to 3 substitutions.
- templates are saved in
- system folder: default
- XDG/coi/templates/: user defined
- the user defined templates shadow default ones if name clashes
- when a command is run once in
path
, savepath/.coi/1.json
where the keys are c, o, i, and template name
TODO:
- default template
- state machine when running main: q, r (always show the shell command to be run)
integration with fzf
If json files exists in a path, we can let the user pick with fzf
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
coi-0.0.6.tar.gz
(6.1 kB
view hashes)