mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: "Benoît Burnichon" <bburnichon@airtag.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] Allow p link to be completed
Date: Mon, 1 Oct 2012 12:25:16 +0200	[thread overview]
Message-ID: <alpine.DEB.2.00.1210011219070.11001@hq0build01.airtag.local> (raw)
In-Reply-To: <20120930130205.GC19651@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]


On Sun, 30 Sep 2012, Michael Olbrich wrote:

> On Fri, Sep 28, 2012 at 05:07:53PM +0200, Benoît Burnichon wrote:
>>  _ptxdist_completion()
>>  {
>> -	local cur cmds opts
>> +	local cur cmds opts _ptxdist_cmd
>> +
>> +	if [ -h './p' ]; then
>> +		_ptxdist_cmd=$(readlink ./p)
>> +	else
>> +		_ptxdist_cmd=ptxdist
>> +	fi
>
> 	if [ "${COMP_WORDS[0]}" = "ptxdist ]; then
> 		_ptxdist_cmd=ptxdist
> 	else
> 		_ptxdist_cmd="$(readlink "${COMP_WORDS[0]}")"
> 	fi
>
> I think. This way we're not limited to ./p
> Or maybe just '_ptxdist_cmd="${COMP_WORDS[0]}"'. I'm not sure if there is
> actually a case when the readlink is needed.
>

Fine with removing limitation to only ./p

Kept the readlink command as there is a case where it does not work.

Suppose you are only type p in your project directory then press <Tab>, 
there will be an issue because the called ptxdist will be p in the current 
directory and bash will not find the ptxdist script as it is not in the 
current directory

>>  complete -F _ptxdist_completion ptxdist
>> +complete -F _ptxdist_completion p
>
> I'm not sure if this last change is a good idea by default. 'p' is rather
> ambiguous. But if we merge the rest, then it's easy to add just this line
> to ~/.bash_completion
>

You're probably right, this is not good idea. Let the users configures 
their own bash_completion to whatever name they choose.

Benoît

[-- Attachment #2: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2012-10-01 10:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 15:07 Benoît Burnichon
2012-09-30 13:02 ` Michael Olbrich
2012-10-01 10:25   ` Benoît Burnichon [this message]
2012-10-01 10:51 ` [ptxdist] [PATCH] Allow links " Benoît Burnichon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1210011219070.11001@hq0build01.airtag.local \
    --to=bburnichon@airtag.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox