Download the PHP package hanneskod/comphlete without Composer
On this page you can find all versions of the php package hanneskod/comphlete. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hanneskod/comphlete
More information about hanneskod/comphlete
Files in hanneskod/comphlete
Package comphlete
Short Description Dynamic bash completion from PHP
License Unlicense
Homepage https://github.com/hanneskod/comphlete
Informations about the package comphlete
comphlete
Dynamic bash completion from PHP
Why?
Say you have a cli script to read some data, using comphlete you can autocomplete data identifiers directly from the command line. It's both fun and powerful. And works well with symfony console apps.
Installation
Usage
With symfony apps
Create an empty symfony console application (here named myapp.php
).
This creates a hidden command named _complete
that handles autocompletion.
To register autocompletion in your enviroment use (in .bashrc
)
NOTE that the
ComphleteCommand
does not work for single command applications. If your application is a single command app you'll have to revert to the default way of createing suggestions. See below.
The (not so) hard way
Create your autocomplete definition in a php script (here named test.php
).
To load into you environment create a bash script (note that this requires
test.php
to be in you PATH
to work properly).
And source it (in .bashrc
)
Using contexts
A common design pattern is to have an application define a number of commands
with their own sets of arguments and options. Comphlete supports this by the use
of contexts. Here is an app with an import
and an export
command.