Re: [dev] [wmii] wimenu custom completion

From: LuX <lux.onthenet_AT_free.fr>
Date: Tue, 17 Aug 2010 15:56:38 +0200

Hello!

Tue, 17 Aug 2010 06:26:37 -0400, Kris Maglione wrote:
> The patch was against your script.

OK, let us call:
- 'post' the last script I have posted, on:
  http://lists.suckless.org/dev/1008/5609.html
- 'patch' and 'script' the patch and script you posted on:
  http://lists.suckless.org/dev/1008/5610.html

I copied 'post' and 'patch' from the online archive to files in the
same directory. No luck:

$ patch post patch
patching file post
Hunk #1 FAILED at 5.
Hunk #2 FAILED at 25.
Hunk #3 FAILED at 46.
Hunk #4 FAILED at 78.
4 out of 4 hunks FAILED -- saving rejects to file post.rej

--> Don't waste your time with this, I must be doing some stupid
mistake somewhere and that's all (I'm not at all used with patching).

Anyway I included by hand in 'post' the modifications listed in
'patch'. Let us call 'past' the resulting script.

> I take it the unmodified script that I posted works (as it does for
> me)?

It works, undoubtedly. But…

- The command 'sh script' produces some strange outputs in the
  terminal when I am typing. This might be normal, since what is
  important is that the very last output is the content of the input
  line, which is the case so the script works anyway.
- 'past' and 'script' have the same behaviour on what concerns the
  input of options.
- 'post' has a different behaviour concerning options.
- Neither the behaviour of 'post' nor the behaviour of 'past' and
  'script' are completely satisfactory in my opinion, for opposite
  reasons.
  
What 'satisfactory' means is highly arguable, so I give examples below
of what I consider 'good' and 'bad' behaviours both in 'script' and
'post'. Of course you might consider that the behaviour of 'script'
and 'past' is exactly what it must be. But could you please let me
know if you have the same behaviour as below?

Examples with 'script':

Input List displayed by wimenu

'lp ' List of files in current dir
'lp -' -o media=a4 -o landscape …
'lp -o ' -o media=a4 -o landscape … --> Good!
'lp -o m' List of files in current dir containing 'm' --> Bad!
'lp -o media=a4 ' List of files in current dir

'ls ' List of files in $HOME
'ls -a' Nothing --> Good.
'ls -a ' Nothing as well --> Bad!
'ls -a w' List of files in current dir containing 'w'

Good and bad examples with 'post' are almost opposite:

Input List displayed by wimenu
'lp ' List of files in current dir
'lp -' -o media=a4 -o landscape …
'lp -o ' List of files in current dir --> Bad!
'lp -o m' List of files in current dir containing 'm' --> Bad (logical).
'lp -o media=a4 ' List of files in current dir

'ls ' List of files in current dir
'ls -a' Nothing --> Good.
'ls -a ' List of files in current dir --> Good!

Perhaps, after all, this additional feature that I have tried to
implement is a 'false good idea', that is a Pandora box. But for the
moment I still hope that it can be given a more 'satisfactory'
behaviour, in the above sense, perhaps by changing slightly the syntax
of the 'opt' array (resp. the $opts file) or such.

Regards,
LuX.

PS: Typical intermediate outputs while I'm running 'script', followed
by what I typed in the input line (so the last output is normal):

$ sh wi_cli.sh *** This is the name I temporarily gave to 'script'
read cat $(wmiir namespace)/.proglist
read ls
read awk <$opts '$0 == "lp:", /^$/ {if(/^[ \t]/) { sub(/^[ \t]+/, "");
print }}'
lp -o media=a4 file
$ *** Back to the prompt (normal)
Received on Tue Aug 17 2010 - 15:56:38 CEST

This archive was generated by hypermail 2.2.0 : Tue Aug 17 2010 - 16:00:04 CEST