Automatically generate boilerplate comments and code for new files with a single command.
cd ~/bin
git clone git@github.com:mbrukman/autogen.git
echo 'alias autogen=~/bin/autogen/autogen' >> ~/.bash_profile
source ~/.bash_profile
For details on adding Autogen support to your editor, please see
the editors
directory.
autogen -c [copyright holder] -l [license] [filename]
Modify an existing file in-place:
autogen -i [...other params as above...]
Bulk update many existing files in-place:
find . -type f -name \*.sh -exec autogen -i --no-top-level-comment [options...] {} \;
The flag --no-top-level-comment
avoids adding a comment such as:
/* TODO: High-level file comment */
because either some or all of the files have such a top-level comment, or if they don't, you probably wouldn't want to have to manually add or delete at this time, if you're just trying to add the license header in bulk.
To get a list of supported licenses, or to see the full set of flags, run
autogen
with no parameters.
File type or language is determined based on the full filename or extension, as
appropriate. See autogen
for a list of recognized file types.
The flag --no-code
skips adding boilerplate code to source files.
The flag --no-runline
skips adding runline to source files.
Sample outputs:
To add a new file type or feature, change autogen
and add
several files to the tests/testdata
directory, namely:
<feature>.in
- the input file containing command-line args to pass toautogen
<feature>.out
- expected stdout for the test<feature>.err
- expected stderr for the test
To generate the *.out
and *.err
files automatically, just add the *.in
files and run make regen
. Then, examine the resulting *.out
and *.err
files.
Other custom tests can be added as separate scripts in the tests
directory. If the file has the suffix _test.sh
, it will be automatically
picked up by tests/run_all_tests.sh
script, which
means that make test
will automatically run it without any other changes.
Be sure to also add an entry for it in tests/BUILD
file for
Bazel to be able to run it as well, including appropriate dependencies on any
data files it may need.
You have two options:
- via Bazel:
bazel test //...
- via Make:
make test
Bazel is typically faster, especially when rerunning tests, due to built-in caching.
Apache 2.0; see LICENSE.txt for details.
This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.