php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52755 Command line is appending a tab when using bash autocompletion via a php script
Submitted: 2010-08-31 23:19 UTC Modified: 2010-09-01 06:27 UTC
From: hassenbentanfous at gmail dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 5.2.14 OS: Ubuntu hardy linux 2.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hassenbentanfous at gmail dot com
New email:
PHP Version: OS:

 

 [2010-08-31 23:19 UTC] hassenbentanfous at gmail dot com
Description:
------------
In order to write a bash autocompletion program using php, you need two 
simple files.

1. bash script
2. php file processing the command and printing it

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

The php script contains a simple "echo".
If I print the echo in python or ruby, it works properly (no tabs appended) and 
each time I press tab the command is printed.
That's how it should work for php as well.

Test script:
---------------
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

----
test.php

<?php
echo "hello";
?>

Expected result:
----------------
"hello" should be appended each time I press "TAB"

Actual result:
--------------
Tabs are appended

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-01 06:27 UTC] aharvey@php.net
-Status: Open +Status: Bogus
 [2010-09-01 06:27 UTC] aharvey@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC