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 regen_testdata.sh
. Then, examine the resulting *.out
and
*.err
files.
Other custom tests can be added as separate scripts in the tests
directory. Add an entry for each *_test.sh
script in the
tests/BUILD
file, including appropriate dependencies on any
data files it may need.
We use Bazel for testing:
bazel test //...
See CONTRIBUTING.md
for details.
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.