在使用bash PHP自动完成选项卡 [英] Tab autocompletion in bash using php

查看:133
本文介绍了在使用bash PHP自动完成选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,伙计们,
  我正在写一个简单的脚本来自动完成,当我preSS TAB。

Hey guys, I'm writing a simple script to autocomplete when I press TAB.

PHP脚本包含一个简单的回声。

The php script contains a simple "echo".

在这种情况下,自动完成的作品,但一个标签附加到输出
使其失去作用。

In this case, the autocomplete works but a "tab" is appended to the output making it useless

从脚本code

scriptPath='/home/hassen/workspace/scripts/bin/test.php'

_dda()
{
    local cur
    COMPREPLY=()
    unset COMP_WORDS[0] #remove "j" from the array
    cur=${COMP_WORDS[*]}
    IFS=$'\n\n' read -d '' -a COMPREPLY < <($scriptPath --completion "$cur")
    return 0
}
complete -F _dda dda

alias dda=$scriptPath

从PHP脚本code

Code from php script

<?php
echo "hello";
?>

下面是讨厌的部分:
如果我打印Python或Ruby的回声,它的工作原理就像一个魅力 - 每个I preSS TAB,它调用的脚本和输出时间,即招呼

Here is the annoying part: If I print the echo in Python or Ruby, it works like a charm -- ie each time I press TAB, it calls the scripts and output hello.

这是用PHP或我的code错误?
他们似乎在 http://bugs.php.net/bug.php?id=不同意52755

Is this a bug with PHP or my code? They seem to disagree at http://bugs.php.net/bug.php?id=52755

推荐答案

它的工作原理如下期望,你的非常的确认PHP文件本身不持有标签,可能以后<$ ?C $ C>&GT;

It works as desired here, are you very sure the PHP file itself doesn't hold a tab, possibly after the ?>?

版本:5.3.2 PHP,GNU bash的版本4.1.5

Versions: PHP 5.3.2, GNU bash version 4.1.5

这篇关于在使用bash PHP自动完成选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆