Re: bash completion and spaces

2021-04-26 Thread Victor Sudakov
davidson wrote: > > > > I actually looked with `hd` and expected to see 0x20 there, but > > somehow see none of it: > > > > $ echo $COMP_WORDBREAKS | hd > > 22 27 40 3e 3c 3d 3b 7c 26 28 3a 0a |"'@><=;|&(:.| > > 000c > > Above I count 12 characters piped from echo to

Re: bash completion and spaces

2021-04-26 Thread David Wright
On Mon 26 Apr 2021 at 18:27:57 (+), davidson wrote: > On Mon, 26 Apr 2021 davidson wrote: > > Two corrections to previous message. > > % Proposal D > > > > $ cat ~/.inputrc # a literal Shift-TAB is inside the double quotes > > " ": menu-complete > > 2. The '^[' above is an artifact of...

Re: bash completion and spaces

2021-04-26 Thread davidson
On Mon, 26 Apr 2021 davidson wrote: Two corrections to previous message. [dd] % Proposal C In that case, you could get all but the last argument completed like so: $ complete -A hostname -P '-h ' -S ' -s' 1. At the end of the line above, the command name is missing. $ complete -A hostnam

Re: bash completion and spaces

2021-04-26 Thread davidson
On Mon, 26 Apr 2021 Victor Sudakov wrote: davidson wrote: On Sat, 24 Apr 2021 Victor Sudakov wrote: David Wright wrote: I have an example app which can be run only as "app3 -h test1 -s foo" or "app3 -h test2 -s bar". So I decided to provide it with a small manual completion for convenience.

Re: bash completion and spaces

2021-04-26 Thread Greg Wooledge
On Mon, Apr 26, 2021 at 01:49:42PM +0200, Thomas Schmitt wrote: > > $ string=' hithere ' > > [...] > > $ printf '<%s> ' $string ; echo > > > > As C programmer i am now tempted to scream. > (This command should really not have the same name as printf(3).) There are a few changes between

Re: bash completion and spaces

2021-04-26 Thread Thomas Schmitt
Hi, Greg Wooledge wrote: > Not the parser, technically. The correct term is word splitting. Always good to know which part of the shell tries to bite me. :)) > $ string=' hithere ' > [...] > $ printf '<%s> ' $string ; echo > As C programmer i am now tempted to scream. (This command

Re: bash completion and spaces

2021-04-26 Thread Greg Wooledge
On Mon, Apr 26, 2021 at 12:04:45PM +0200, Thomas Schmitt wrote: > > what accounts for the three missing characters (namely SPACE, TAB, > > and NEWLINE)? > > They get eaten by the shell parser if you do not use quotation marks: > > $ echo $COMP_WORDBREAKS | wc -c > 11 > $ echo "$COMP_WORDBRE

Re: bash completion and spaces

2021-04-26 Thread Thomas Schmitt
Hi, > what accounts for the three missing characters (namely SPACE, TAB, > and NEWLINE)? They get eaten by the shell parser if you do not use quotation marks: $ echo $COMP_WORDBREAKS | wc -c 11 $ echo "$COMP_WORDBREAKS" | wc -c 14 So to see all characters (including the newline added by

Re: bash completion and spaces

2021-04-26 Thread davidson
On Mon, 26 Apr 2021 Victor Sudakov wrote: davidson wrote: On Sat, 24 Apr 2021 Victor Sudakov wrote: [dd] BTW on my current Debian system I don't see the space character in $COMP_WORDBREAKS. If you have xxd installed, what does xxd show you? I actually looked with `hd` and expected to see

Re: bash completion and spaces

2021-04-25 Thread Victor Sudakov
David Wright wrote: [dd] > > > > I also don't understand what you mean by "dynamic", particularly as > > > you wrote "A static (-W) completion" above. > > > > I actually meant that a simple example of static completion with spaces > > (if someone cares to provide it) would help me understand t

Re: bash completion and spaces

2021-04-25 Thread Victor Sudakov
davidson wrote: > On Sat, 24 Apr 2021 Victor Sudakov wrote: > > David Wright wrote: > > > > > > > > > > > > I have an example app which can be run only as "app3 -h test1 -s > > > > > > foo" or "app3 -h test2 -s bar". So I decided to provide it with > > > > > > a small manual completion for conveni

Re: bash completion and spaces

2021-04-24 Thread David Wright
On Sat 24 Apr 2021 at 13:46:24 (+0700), Victor Sudakov wrote: > David Wright wrote: > > > > > > > > > > I have an example app which can be run only as "app3 -h test1 -s foo" > > > > > or > > > > > "app3 -h test2 -s bar". So I decided to provide it with a small manual > > > > > completion for conv

Re: bash completion and spaces

2021-04-24 Thread davidson
On Sat, 24 Apr 2021 Victor Sudakov wrote: David Wright wrote: I have an example app which can be run only as "app3 -h test1 -s foo" or "app3 -h test2 -s bar". So I decided to provide it with a small manual completion for convenience. [vas@test2 ~]$ ./list.sh -h test1 -s foo -h test2 -s bar [va

Re: bash completion and spaces

2021-04-23 Thread Victor Sudakov
David Wright wrote: > > > > > > > > I have an example app which can be run only as "app3 -h test1 -s foo" or > > > > "app3 -h test2 -s bar". So I decided to provide it with a small manual > > > > completion for convenience. > > > > > > > > [vas@test2 ~]$ ./list.sh > > > > -h test1 -s foo > > > >

Re: bash completion and spaces

2021-04-23 Thread David Wright
On Thu 22 Apr 2021 at 21:38:53 (+0700), Victor Sudakov wrote: > David Wright wrote: > > Victor Sudakov wrote: > > > > > > I have an example app which can be run only as "app3 -h test1 -s foo" or > > > "app3 -h test2 -s bar". So I decided to provide it with a small manual > > > completion for conve

Re: bash completion and spaces

2021-04-22 Thread Victor Sudakov
David Wright wrote: > > > > I have an example app which can be run only as "app3 -h test1 -s foo" or > > "app3 -h test2 -s bar". So I decided to provide it with a small manual > > completion for convenience. > > > > [vas@test2 ~]$ ./list.sh > > -h test1 -s foo > > -h test2 -s bar > > [vas@test2

Re: bash completion and spaces

2021-04-22 Thread David Wright
On Thu 22 Apr 2021 at 15:28:36 (+0700), Victor Sudakov wrote: > > I have an example app which can be run only as "app3 -h test1 -s foo" or > "app3 -h test2 -s bar". So I decided to provide it with a small manual > completion for convenience. > > [vas@test2 ~]$ ./list.sh > -h test1 -s foo > -h te

bash completion and spaces

2021-04-22 Thread Victor Sudakov
Dear Colleagues, I have an example app which can be run only as "app3 -h test1 -s foo" or "app3 -h test2 -s bar". So I decided to provide it with a small manual completion for convenience. [vas@test2 ~]$ ./list.sh -h test1 -s foo -h test2 -s bar [vas@test2 ~]$ complete -C ./list.sh app3 [vas@tes