module Lono
Code
Explanation:
There are 3 types of things to auto-complete:
1. command: the command itself 2. parameters: command parameters. 3. options: command options
Here's an example:
mycli hello name --from me * command: hello * parameters: name * option: --from
When command parameters are done processing, the remaining completion words will be options. We can tell that the command params are completed based on the method arity.
## Arity
For example, say you had a method for a CLI
command with the following form:
ufo scale service count --cluster development
It's equivalent ruby method:
scale(service, count) = has an arity of 2
So typing:
ufo scale service count [TAB] # there are 3 parameters including the "scale" command according to Thor's CLI processing.
So the completion should only show options, something like this:
Using md5sum on the zipped file will an always changing value since the timestamp and other metadata of the zipfile changes whenever we create it.
This is custom checksum logic that only accounts for the contents of the files in the directory.
Note moving this under Lono::CLI::Opts messes with the zeitwerk autoloader. A weird workaround is calling Lono::CLI::Opts right after the autoloader and then it seems to fix itself. It may be because there's a custom infleciton cli => CLI
. Unsure. Unsure if there are other side-effects with the workaround so named this: Lono::Opts
instead of Lono::CLI::Opts
Also, there's Thor
Options class, so this is named Opts
to avoid having to fully qualify it.
Constants
- API
- API_DEFAULT
- VERSION