A problem existed where more than one command would not work (always or
in some conditions depending on the command: not sure which). This
prevented a fix in years.html which will be in the next commit. The sgit
repo has been updated with this fix as well.
The fix is to remove space from IFS and to change "${SED_COMMANDS[*]}"
to be "${SED_COMMANDS[@]}".
Now allows to not overwrite files.
Now allows sed options to be passed to sed.
Allows specifying path to sed.
This script now has its own repo at https://github.com/xexyl/sgit. I
don't expect many people to use it but it seemed like it was worthy of a
repo as it is a pretty handy script (though far from perfect).
New version of sgit.
Script now allows for spaces in sed commands. Thus one can do something
like:
sgit -v3 -x -e 's/web site/website/g' .
to set verbosity to level 3, turn on tracing (see below) and change
occurrences of 'web site' to be 'website'.
Also added -x option to turn on tracing.
Accidentally committed absolute path of sed.
Also it now shows the sed commands with high enough -v level. This is to
help with a strange problem I discovered (not fixed yet).
Script no longer requires GNU sed but works with other sed
implementations as well (only other one tested is macOS however).
Uses getopts to parse options. Usage is now:
usage: sgit [-h] [-V] [-v level] [-e command] <glob...>
-h print help and exit
-V print version and exit
-v level set verbosity level
-e command append sed command to execute on globs
which means that yes one can specify more than one glob. As long as one
sed command is specified (chose -e to match sed) and one arg is
specified after the last option then the command line is okay (whether
the sed command or file is okay is another matter entirely).
Verbose output to help test / debug features or if just interested in
what's being done.
Added `bin/sgit`.
This directory is NOT intended to become a huge software project
right now. For now it is just a convenient place to store tools.
Please avoid overthinking, over documenting tools under bin.
Later on there will be a tool that builds links in the web site
from JSON files, perhaps forms HTML files from markdown files, etc.
However we will have to make major progress on issue #1, issue #2,
issue #3 and issue #4 before such code can be written.
In some cases tools put under bin might go away later on
if they are no longer needed.