Project

fylla

0.01
Low commit activity in last 3 years
No release in over a year
Fylla generates zsh and bash autocomplete scripts for Thor CLI applications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.1.14
~> 5.0
~> 13
~> 1.21
~> 0.6.0

Runtime

>= 0.19.0
 Project Readme

Build Status codecov Ruby gem

Fylla

Fylla, the Norse word for complete, is an autocompletion script generator for the Thor framework.

It currently generates zsh completion scripts, but will soon have support for bash scripts as well.

Installation

Add this line to your application's Gemfile:

gem 'fylla'

And then execute:

$ bundle

Or install it yourself as:

$ gem install fylla

Usage

require 'thor'
require 'fylla' # needs to come before anything that forces Thor configuration
require 'cli' # has code like `class CLI < Thor` which forces Thor configuration

Fylla.load('cli') # must come before `#start()`

CLI.start(ARGV)

Fylla must be loaded before Thor.start is called in order for it to be used.

require 'fylla' must be called before any Thor code is accessed if you would like to use the completion: option. If you do not care about using the completion: flag in Options, then this requirement does not need to be met.

General use case will be to create a new subcommand or option that calls Fylla.zsh_completion(self)

Fylla#zsh_completion returns a string containing the entire zsh completion script, that you can use to do what you see fit.

Same for bash completion.

The only requirement for calling Fylla.zsh_completion(self) is that Thor has loaded all commands/options/etc.

For some examples, you can reference the test folder

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/snowe2010/fylla. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the Fylla project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Todo list

  • use desc if banner isn't present
  • add completion parameter to Option class to use by default
  • allow zsh_completion and bash_completion to be called from anywhere. This might be impossible.
  • allow supplying custom templates