Bash/Shell autocompletion for Composer

Overview

Bash/Shell Autocompletion for Composer

Source License

composer-autocomplete provides Bash/Shell autocompletion for Composer.

Built by Bram(us) Van Damme (https://www.bram.us) and Contributors

Prerequisites

If the complete command is not available on your system, you can install bash-completion using Homebrew

brew install bash-completion

Installation

  1. Download the file composer-autocomplete from this repo

    curl -#L https://github.com/bramus/composer-autocomplete/tarball/master | tar -xzv --strip-components 1 --exclude={LICENSE,README.md}
  2. Move the file composer-autocomplete to ~

    mv ./composer-autocomplete ~/composer-autocomplete
  3. Load composer-autocomplete from within your ~/.bash_profile

    Either manually add this snippet to your ~/.bash_profile:

    if [ -f "$HOME/composer-autocomplete" ] ; then
        . $HOME/composer-autocomplete
    fi

    Or use this set of commands to do it automatically:

    echo "" >> ~/.bash_profile
    echo 'if [ -f "$HOME/composer-autocomplete" ] ; then' >> ~/.bash_profile
    echo '    . $HOME/composer-autocomplete' >> ~/.bash_profile
    echo "fi" >> ~/.bash_profile
  4. Restart your shell, or reload your ~/.bash_profile

    source ~/.bash_profile

Usage

To list composer commands:

$ composer [TAB][TAB]
about                clear-cache          create-project       dumpautoload         home                 install              prohibits            search               status               upgrade
archive              clearcache           depends              exec                 i                    licenses             remove               self-update          suggests             validate
browse               command              diagnose             global               info                 list                 require              selfupdate           u                    why
check-platform-reqs  config               dump-autoload        help                 init                 outdated             run-script           show                 update               why-not

To complete a composer commands:

$ composer in[TAB][TAB]
info     init     install

To list options for a composer command:

$ composer install -[TAB][TAB]
--                        --dev                     --no-ansi                 --no-interaction          --no-suggest              --profile                 --working-dir             -h                        -v
--ansi                    --dry-run                 --no-autoloader           --no-plugins              --optimize-autoloader     --quiet                   -V                        -n
--apcu-autoloader         --help                    --no-custom-installers    --no-progress             --prefer-dist             --verbose                 -a                        -o
--classmap-authoritative  --ignore-platform-reqs    --no-dev                  --no-scripts              --prefer-source           --version                 -d                        -q

To complete Composer scripts (example):

$ composer run-script [TAB][TAB]
fix   lint  test

Acknowledgements

This project builds upon Rob Allen's previous work in this area.

License

composer-autocomplete is released under the MIT public license. See the enclosed LICENSE for details.

Comments
  • _get_comp_words_by_ref: command not found

    _get_comp_words_by_ref: command not found

    Hello,

    I'm trying to use this on macOS. After installation I type composer [TAB][TAB] and get the following error:

    composer -bash: _get_comp_words_by_ref: command not found

    Image for clarification: Screenshot 2019-05-31 at 09 43 24

    I've tried installing bash-autocompletion with brew install bash-completion but that didn't work.

    opened by koenhendriks 6
  • Add support for composer.phar.

    Add support for composer.phar.

    Hey,

    This pull request extends the completion to composer.phar executables. Additionally support for composer and composer.phar executables outside of PATH, given with a relative or absolute filesystem path, is also added.

    opened by mundry 1
  • [FIX] Fixes issue with hirak/prestissimo

    [FIX] Fixes issue with hirak/prestissimo

    Trying to get options for update subcommand can result in a long waiting period and seemingly unresponsive bash completion when composer plugin 'hirak/prestissimo' is being used. The latter will prefetch repositories whenever encountering the subcommands install, update and the likes. When a project uses many dependencies and repositories, this can take a while. An issue has also been filed with prestissimo plugin (see https://github.com/hirak/prestissimo/issues/225) yet using the help [command] subcommand in favor to [command] -h in order to retrieve all available options seems more reliable anyway.

    opened by troggybrains 0
  • Complete package names for update command.

    Complete package names for update command.

    This PR adds completion for packages listed in the require and require-dev sections of composer.json when completing update, alongside its arguments.

    This functionality is only available if jq is installed.

    opened by mundry 0
  • Complete package names for more commands

    Complete package names for more commands

    AFAICT package names currently are completed only for the update command. I think it would be useful for:

    • show / info
    • prohibits / why-not
    • depends/ why

    And maybe some more. Should I provide a PR or will you make a quick update yourself?

    PS! Thx for the excellent work.

    opened by hansfn 0
  • Zsh: command not found: complete

    Zsh: command not found: complete

    I followed the same installation instructions but after running

    $ source ~/.zshrc
    

    getting this error: /home/ahmedwaleed/composer-autocomplete:39: command not found: complete

    Inside .zshrc

    if [ -f "$HOME/composer-autocomplete" ] ; then
        . $HOME/composer-autocomplete
    fi
    
    opened by AhmadWaleed 1
Owner
Bramus!
Senior Frontend Dev with a love for HTML, CSS, and JS — in that order. Also speaks PHP and SQL when needed. Former University Lecturer "Web & Mobile".
Bramus!
Shell script for Git module deployment with include/exclude filters.

Deploy multiple Git repositories in an unique folder modgit is a shell script for deploying multiple Git repositories in root folder of any project, w

Johann Reinké 175 Nov 22, 2022
Tool to convert from composer.yml to composer.json.

composer-yaml This project allows you to convert a composer.yml file into composer.json format. It will use those exact filenames of your current work

Igor 56 Sep 28, 2022
Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology.

Stash View Stash view is a composer package for Laravel which caches views using Russian Doll Caching methodology. What is Russian Doll Caching ? It i

Bhushan Gaikwad 18 Nov 20, 2022
Composer package which adds support for HTML5 elements using Laravels Form interface (e.g. Form::date())

Laravel HTML 5 Inputs Composer package which adds support for HTML5 elements by extending Laravel's Form interface (e.g. Form::date()) Adds support fo

Small Dog Studios 11 Oct 13, 2020
Composer repository implementation for ZIPs.

Release Belt — Composer repo for ZIPs Release Belt is a Composer repository, which serves to quickly integrate third–party non–Composer releases into

Andrey Savchenko 151 Oct 17, 2022
A Composer script to lint a Travis CI configuration file.

composer-travis-lint composer-travis-lint is a Composer script that lints a project/micro-package its Travis CI configuration aka its .travis.yml file

Raphael Stolt 6 Jan 31, 2020
Slim Jam is a demo application to provide examples for composer package, PHPSpreadsheet, Shopify API etc. usages.

SLIM JAM Slim Jam is a demo application to provide examples for composer package, PHPSpreadsheet, Shopify API etc. usages. This project aims to take a

Uğur ARICI 2 Jan 9, 2022
A package that adds view-composer like feature to Inertia.js Laravel adapter

Kinetic A package that adds view-composer like feature to Inertia.js Laravel adapter. Use to be able to share props based on the Inertia component nam

Marvin Quezon 76 Dec 12, 2022
Composer plugin for cleaning up unused files from packages.

Composer Cleanup Plugin Remove tests & documentation from the vendor dir. Based on laravel-vendor-cleanup but implemented as a Composer Plugin instead

Barry vd. Heuvel 136 Dec 15, 2022
This is a Composer plugin that provides an automated version of Country Codes database.

Country Codes This is a Composer plugin that provides an automated version of Country Codes database. This database is include: country iso codes, cou

Robert Nicjoo 19 Sep 3, 2022
PHP Reverse Shell > reverse-shell.php

PHP Reverse Shell > reverse-shell.php PHP Cmd Shell > cmd.php JPG cmd Shell > cmd.jpg /etc/passwd Pulling Shell > etc-passwd.php Configuration Pulling

Dark-Network 5 Feb 24, 2022
A multi-purpose web-shell that simplifies running shell commands on webserver

This webshell can be used for multi-purposed especially most if you want to manage your web server but you are in an emergency , so why not use a webshell:)

urchinsec 5 Oct 13, 2022
Provides autocompletion for Craft CMS and plugins in Twig templates.

Autocomplete for Craft CMS Provides autocompletion for Craft CMS and plugins in Twig templates. Currently works with PhpStorm only, as VSCode does not

PutYourLightsOn 12 Nov 23, 2021
Magento 2 Bash Install/Restore Script

Magento 2 Bash Install/Restore Script This script is designed to simplify the installation process of Magento 2 and rapid deployment of merchant code

Yarik Voronoy 80 Sep 30, 2022
This Laravel Nova tool lets you run artisan and bash commands directly from Nova 4 or higher.

Laravel Nova tool for running Artisan & Shell commands. This Nova tool lets you run artisan and bash commands directly from nova. This is an extended

Artem Stepanenko 17 Dec 15, 2022
Hentai Bash - This is the core of Hentai Terminal, responsible for the basic functions and commands

Hentai Bash - This is the core of Hentai Terminal, responsible for the basic functions and commands. It is mainly used for writing and executing commands.

Hentai Group 1 Jan 26, 2022
Bash version of the VK client written in PHP.

VK-CLI VK Messenger in your Linux Terminal PHP8 Installation wget https://jenkins.pmmp.io/job/PHP-8.0-Aggregate/lastSuccessfulBuild/artifact/PHP-8.0-L

David Ratnikov 4 Nov 5, 2022
A composer plugin, to install differenty types of composer packages in custom directories outside the default composer default installation path which is in the vendor folder.

composer-custom-directory-installer A composer plugin, to install differenty types of composer packages in custom directories outside the default comp

Mina Nabil Sami 136 Dec 30, 2022
ReactPHP Shell, based on the Symfony Console component.

Pecan Event-driven, non-blocking shell for ReactPHP. Pecan (/pɪˈkɑːn/) provides a non-blocking alternative to the shell provided in the Symfony Consol

Michael Crumm 43 Sep 4, 2022
A developer-friendly wrapper around execution of shell commands.

ptlis/shell-command A developer-friendly wrapper around execution of shell commands. There were several goals that inspired the creation of this packa

brian ridley 18 Dec 31, 2022