Sydney
A Treetop parser for bash alias files. Organize your aliases by sections and keep comments associated with the aliases they document.
Sydney was created to feed my process an alias file and feed it to cheaters, an excellent cheatsheet system by Brett Terpstra. The output from Sydney can be a Treetop::Runtime::SyntaxNode tree, an array of the sections in your alias file, or an array of the aliases without section groupings.
Installation
Install it yourself as:
$ gem install sydney
Usage
Feed your alias file to Sydney as a single string.
Sydney.parse(IO.readlines("/my/home/folder/.aliases").join)
Sydney.parse returns a Treetop syntax tree. If you organize your alias
file into sections, preceeding each section with double-banged comments,
you can use Sydney.sections
to return an array of Section nodes. Sydney.aliases
returns an array of AliasEntry nodes, with sections flattened out.
Each section contains one or more AliasEntry nodes. An AliasEntry node ties comments (AliasComment) before an alias to the definition (AliasDefinition). See the documentation
Credits
Sydney was created and is maintained by Geoff Harcourt at Five Tool Development.
Contributing
I'm looking for further ideas for Sydney. Please report parsing issues through Github Issues. Pull requests for feature additions are welcome!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request