symfony-console-autocomplete

授权协议 View license
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 梁丘成和
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Symfony console autocomplete

Enables shell autocompletion for tools based on theSymfony Console(Symfony framework, Composer, PHPSpec, Behat, etc.)

Prerequisites

  • Make sure the global composer project is configured properly with your shell.Notably, the composer global bin directory needs to be in your path.See https://getcomposer.org/doc/03-cli.md#global for instructions on how todo that.
  • If you're using bash, you'll have to make sure programmable completion functions are available. Linux distributions usually ship it and enable it by default. On Mac OSX, you can install it with brew (brew install bash-completion) and enable it by adding source $(brew --prefix)/etc/bash_completion at the end of your .bashrc.

Installation

Install the tool globally with Composer :

composer global require bamarni/symfony-console-autocomplete

Quick setup

Add the following line at the end of your shell configuration file (~/.bash_profile or ~/.zshrc) :

eval "$(symfony-autocomplete)"

Close / re-open your terminal window and you're ready to go!

Static setup

If you don't like all the magic from the quick setup and want to go with a more standard way,you can dump a static completion file for a given tool :

symfony-autocomplete composer

This will print the completion script for Composer to stdout. The output should be savedat a specific location depending on your OS / setup. Here are a few examples :

# BASH - Ubuntu / Debian
symfony-autocomplete composer | sudo tee /etc/bash_completion.d/composer

# BASH - Mac OSX (with Homebrew "bash-completion")
symfony-autocomplete composer > $(brew --prefix)/etc/bash_completion.d/composer

# ZSH - Config file
symfony-autocomplete composer > ~/.composer_completion && echo "source ~/.composer_completion" >> ~/.zshrc

# FISH
symfony-autocomplete --shell=fish composer > ~/.config/fish/completions/composer.fish

If you are running an environment that does not have automatic execution of PHP scripts, then you will need tocall PHP and the script in question :

symfony-autocomplete "php ./artisan"

General tips

Update

To update the tool to a new version use :

composer global update bamarni/symfony-console-autocomplete

Symfony framework completion

In order to get completion running, you shouldn't prepend php at the beginning of the command :

app/console [TAB]

Tips for Bash users

Alias support

By default, completion for your aliases won't be enabled. If you're using aliases(e.g. "c" for "composer", "pspec" for "phpspec", etc.), you have to pass them explicitly :

symfony-autocomplete --aliases=c --aliases=pspec

Tips for Docker users

Defining the SHELL environment variable

If you connect to your container using something similar to docker exec -it container bash thenyou may find that the completions cannot be built due to an inability to locate the SHELLenvironment variable. This has been reported in https://github.com/bamarni/symfony-console-autocomplete/issues/32

A solution is to supply the SHELL environment variable as part of the docker exec command:

docker exec -e SHELL=bash -it container bash

Supported tools

All tools using the Symfony Console component are supported,here is a non-exhaustive list :

  • composer
  • php-cs-fixer
  • behat
  • phpspec
  • robo
  • deployer
  • laravel artisan
  • roadiz
  • magento 2 console
 相关资料
  • BASH/ZSH auto-complete for Symfony Console applications This package provides automatic (tab) completion in BASH and ZSH for Symfony Console Component based applications. With zero configuration, this

  • Console模块用于跟踪调试的API,可根据调试需求输出日志,协助开发人员定位业务逻辑问题。 方法: log: 记录用户日志 info: 记录用户提示信息 warn: 记录用户警告信息 error: 记录用户错误信息 assert: 断言操作 权限: 5+功能模块(permissions) { // ... "permissions":{ // ... "Console": { "de

  • Console模块用于跟踪调试的API,可根据调试需求输出日志,协助开发人员定位业务逻辑问题。 方法: log: 记录用户日志 info: 记录用户提示信息 warn: 记录用户警告信息 error: 记录用户错误信息 assert: 断言操作 权限: 5+功能模块(permissions) { // ... "permissions":{ // ... "Console": { "de

  • This plugin is meant to ensure that console.log() is as useful as it can be. It adds additional function for iOS, Ubuntu, Windows Phone 8, and Windows. If you are happy with how console.log() works fo

  • Node.js console是一个全局对象,用于向stdout和stderr打印不同级别的消息。 有内置方法可用于打印信息,警告和错误消息。 它在目标是文件或终端时以同步方式使用,而在目标是管道时以异步方式使用。 控制台方法 以下是控制台全局对象可用的方法列表。 Sr.No. 方法和描述 1 console.log([data][, ...]) 用换行符打印到stdout。 这个函数可以在pri

  • MOAC developed based on the Ethereum project. It also implements a javascript runtime environment (JSRE) that can be used in either interactive (console) or non-interactive (script) mode. MOAC Javascr