zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: complete rpm --{resign,addsign} in local
@ 2000-06-07  8:01 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 2000-06-07  8:01 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Jun 5, 10:54am, Sven Wischnowsky wrote:
>
> ...
>  
> } What makes me cringe is the case where we have -xy and both options
> } have arguments...
> 
> You mean like `tar fvcbz foo.tar.gz 1024 foo'?
> 
> I don't think it's incumbent upon _arguments to handle this without help;
> that's exactly what the state machine is for.  It just has to be possible
> to tell _arguments that other option letters are allowed in the string of
> options even after one that has a following argument, so that it can go
> to the right next state.
> 
> This could be done by something like `_arguments -s+ ...' if it's too
> awful to come up with still more OPTSPEC syntax (which I'm beginning to
> believe that it is).

After thinking some more about this... I think we have to make
comparguments understand this because it has to be able to skip over
the arguments when completer after them. Right?

Maybe I'll have a look at this at the weekend.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
@ 2000-06-06  9:56 Sven Wischnowsky
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Wischnowsky @ 2000-06-06  9:56 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> ...
> 
> I don't think it's incumbent upon _arguments to handle this without help;
> that's exactly what the state machine is for.  It just has to be possible
> to tell _arguments that other option letters are allowed in the string of
> options even after one that has a following argument, so that it can go
> to the right next state.

Yep. Good.

> This could be done by something like `_arguments -s+ ...' if it's too
> awful to come up with still more OPTSPEC syntax (which I'm beginning to
> believe that it is).

I'll have a look...

> ...
> 
> Of course the compadd in _rpm needs a `-S ""' added to it.  Which reminds
> me ... I tried changing that compadd to be:
> 
> 	_alternative ... 'prefixes:URL prefix:compadd \ ftp://'
> 
> to try to force a leading space onto the command line, but what got put
> on the command line *included* the backslash.  What's up with that?  It
> works to put a backslashed space in the pattern for '_files -g ...'.

_path_files does it's own quoting. With compadd you get the usual
normalised quoted form. You can use -P ' ' or -i ' ' to prepend the
unquoted space, but of course, you'll then get one space per
completion attempt because following completions can't know that the
space came from a previous completion.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
  2000-06-05  9:47     ` Oliver Kiddle
@ 2000-06-05 15:03       ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2000-06-05 15:03 UTC (permalink / raw)
  To: zsh-workers

On Jun 5, 10:54am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: complete rpm --{resign,addsign} in local
}
} Bart Schaefer wrote:
} 
} > On Jun 4,  5:09pm, Clint Adams wrote:
} > } 
} > } zsh is still completing filenames directly after rpm -qcp or -qpc,
} > } with no space, FWIW.
} > 
} > Currently _rpm uses `-p+' as the spec for the -p option.  That means that
} > anything that will follow the -p (including package file name) is allowed
} > to appear in the same word, or in the next word.
} 
} Hrm. So we have to make it complete option arguments in the next
} word(s) even if the option string doesn't end in the option, right?

In this case, that's correct.  It's analogous to 

	tar fvxz foo.tar.gz

(The _approximate and _correct completers have a wonderful time with tar,
by the way.)
 
} What makes me cringe is the case where we have -xy and both options
} have arguments...

You mean like `tar fvcbz foo.tar.gz 1024 foo'?

I don't think it's incumbent upon _arguments to handle this without help;
that's exactly what the state machine is for.  It just has to be possible
to tell _arguments that other option letters are allowed in the string of
options even after one that has a following argument, so that it can go
to the right next state.

This could be done by something like `_arguments -s+ ...' if it's too
awful to come up with still more OPTSPEC syntax (which I'm beginning to
believe that it is).

On Jun 5, 10:47am, Oliver Kiddle wrote:
} Subject: Re: PATCH: complete rpm --{resign,addsign} in local
}
} Bart Schaefer wrote:
} 
} > Meanwhile, it ought to complete http URLs as well as ftp.
} 
} Shouldn't we be calling _urls here instead of partially repeating it?

_rpm doesn't really repeat any of _urls.  It makes no attempt to complete
whatever comes after the host name.

} It shouldn't be too hard to adapt _urls to pass any -g options to any
} _files so we could tell it here to complete .rpm files only. The only
} slightly messy part would be preventing it from completing gopher and
} file urls; any ideas?

If you leave a `compset -P ...' and `compadd ftp:// http://' in _rpm and
simply replace the call to _hosts with a call to _urls, that should be
enough to restrict the URL types, shouldn't it?

Oh, but it's not, because _urls doesn't handle IPREFIX properly.  It'll
happily complete http://<TAB> into http://gopher:// ...

Of course the compadd in _rpm needs a `-S ""' added to it.  Which reminds
me ... I tried changing that compadd to be:

	_alternative ... 'prefixes:URL prefix:compadd \ ftp://'

to try to force a leading space onto the command line, but what got put
on the command line *included* the backslash.  What's up with that?  It
works to put a backslashed space in the pattern for '_files -g ...'.

} Peter: A build I set off on Saturday on AIX has failed with one of the
} usual dependency problems so don't make any releases until I've commited

Oops.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
  2000-06-05  1:18   ` Bart Schaefer
@ 2000-06-05  9:47     ` Oliver Kiddle
  2000-06-05 15:03       ` Bart Schaefer
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Kiddle @ 2000-06-05  9:47 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> Meanwhile, it ought to complete http URLs as well as ftp.

>    package_file)
> -    if compset -P ftp://; then
> +    if compset -P '(f|ht)tp://'; then
>        _hosts -S/ && ret=0
>      else

Shouldn't we be calling _urls here instead of partially repeating it? It
shouldn't be too hard to adapt _urls to pass any -g options to any
_files so we could tell it here to complete .rpm files only. The only
slightly messy part would be preventing it from completing gopher and
file urls; any ideas? Maybe _urls should have an option to restrict the
url types.
I can make these changes but don't use rpm so it'd be useful to hear if
anyone thinks this would be useful.

Peter: A build I set off on Saturday on AIX has failed with one of the
usual dependency problems so don't make any releases until I've commited
a patch which may be a while later today as our old RS/6000s take quite
a while to do a build.

Oliver


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
@ 2000-06-05  8:54 Sven Wischnowsky
  2000-06-04 19:37 ` Chmouel Boudjnah
  0 siblings, 1 reply; 9+ messages in thread
From: Sven Wischnowsky @ 2000-06-05  8:54 UTC (permalink / raw)
  To: zsh-workers


Bart Schaefer wrote:

> On Jun 4,  5:09pm, Clint Adams wrote:
> } Subject: Re: PATCH: complete rpm --{resign,addsign} in local
> }
> } > Index: Completion/Linux/_rpm
> } 
> } zsh is still completing filenames directly after rpm -qcp or -qpc,
> } with no space, FWIW.
> 
> This is problematic.
> 
> Currently _rpm uses `-p+' as the spec for the -p option.  That means that
> anything that will follow the -p (including package file name) is allowed
> to appear in the same word, or in the next word.
> 
> If we remove the `+', then "rpm -qpc" doesn't match the spec `-p', and so
> completion doesn't enter the `package_file' state -- it instead enters the
> `package_or_file' state (the default spec from the `query' state).
> 
> If there's a clever workaround for this, I don't know it.  (Perhaps this
> is an indication of some lingering bugginess with `_arguments -s'?)

Hrm. So we have to make it complete option arguments in the next
word(s) even if the option string doesn't end in the option, right?

What makes me cringe is the case where we have -xy and both options
have arguments...

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
  2000-06-04 19:37 ` Chmouel Boudjnah
  2000-06-04 21:09   ` Clint Adams
@ 2000-06-05  1:18   ` Bart Schaefer
  2000-06-05  9:47     ` Oliver Kiddle
  1 sibling, 1 reply; 9+ messages in thread
From: Bart Schaefer @ 2000-06-05  1:18 UTC (permalink / raw)
  To: zsh-workers

On Jun 4,  9:37pm, Chmouel Boudjnah wrote:
} Subject: PATCH: complete rpm --{resign,addsign} in local
}
} --{rebuild,recompile} is always local files :
                                  ^^^^^

} +  --{resign,addsign}':*:RPM package:->package_file' \
                                         ^^^^^^^^^^^^

The package_file state will complete remote files via ftp URLs, as well as
local files.  If it really is the case that you can only rebuild a local
package file, the _rpm machine needs another state.

Meanwhile, it ought to complete http URLs as well as ftp.

Index: Completion/Linux/_rpm
===================================================================
@@ -211,12 +211,12 @@
         _files -g \*.spec && ret=0
     ;;
   package_file)
-    if compset -P ftp://; then
+    if compset -P '(f|ht)tp://'; then
       _hosts -S/ && ret=0
     else
       _alternative \
           'files:RPM package file:_files -g \*.\(\#i\)rpm' \
-          'prefixes:ftp URL prefix:compadd ftp://' && ret=0
+          'prefixes:URL prefix:compadd ftp:// http://' && ret=0
     fi
     ;;
   package_src)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
  2000-06-04 21:09   ` Clint Adams
@ 2000-06-05  1:13     ` Bart Schaefer
  0 siblings, 0 replies; 9+ messages in thread
From: Bart Schaefer @ 2000-06-05  1:13 UTC (permalink / raw)
  To: zsh-workers

On Jun 4,  5:09pm, Clint Adams wrote:
} Subject: Re: PATCH: complete rpm --{resign,addsign} in local
}
} > Index: Completion/Linux/_rpm
} 
} zsh is still completing filenames directly after rpm -qcp or -qpc,
} with no space, FWIW.

This is problematic.

Currently _rpm uses `-p+' as the spec for the -p option.  That means that
anything that will follow the -p (including package file name) is allowed
to appear in the same word, or in the next word.

If we remove the `+', then "rpm -qpc" doesn't match the spec `-p', and so
completion doesn't enter the `package_file' state -- it instead enters the
`package_or_file' state (the default spec from the `query' state).

If there's a clever workaround for this, I don't know it.  (Perhaps this
is an indication of some lingering bugginess with `_arguments -s'?)

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH: complete rpm --{resign,addsign} in local
  2000-06-04 19:37 ` Chmouel Boudjnah
@ 2000-06-04 21:09   ` Clint Adams
  2000-06-05  1:13     ` Bart Schaefer
  2000-06-05  1:18   ` Bart Schaefer
  1 sibling, 1 reply; 9+ messages in thread
From: Clint Adams @ 2000-06-04 21:09 UTC (permalink / raw)
  To: Chmouel Boudjnah; +Cc: zsh-workers

> Index: Completion/Linux/_rpm

zsh is still completing filenames directly after rpm -qcp or -qpc,
with no space, FWIW.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* PATCH: complete rpm --{resign,addsign} in local
@ 2000-06-04 19:37 ` Chmouel Boudjnah
  2000-06-04 21:09   ` Clint Adams
  2000-06-05  1:18   ` Bart Schaefer
  0 siblings, 2 replies; 9+ messages in thread
From: Chmouel Boudjnah @ 2000-06-04 19:37 UTC (permalink / raw)
  To: zsh-workers


--{rebuild,recompile} is always local files :

Index: Completion/Linux/_rpm
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/_rpm,v
retrieving revision 1.11
diff -u -r1.11 _rpm
--- Completion/Linux/_rpm       2000/05/30 07:49:00     1.11
+++ Completion/Linux/_rpm       2000/06/04 19:35:56
@@ -92,7 +92,7 @@
   '(-e)--erase:*:uninstall:->uninstall' \
   '-b+[build mode (spec file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_b' \
   '(-b)-t+[build mode (tar file)]:build stage:((p\:execute\ \%prep\ stage l\:do\ a\ list\ check c\:execute\ build\ stage i\:execute\ install\ stage b\:build\ a\ binary\ package a\:build\ binary\ and\ source\ packages)):*:build:->build_t' \
-  --{resign,addsign}':*:RPM package:->package' \
+  --{resign,addsign}':*:RPM package:->package_file' \
   '--rmsource:*:spec file:->spec_file' \
   --{rebuild,recompile}':*:Src RPM files:->package_src' \
   '(--checksig)-K+[signature check mode]:*:sigcheck:->sigcheck' \


-- 
MandrakeSoft Inc                http://www.mandrakesoft.com
In travel.                                        --Chmouel


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2000-06-07  8:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-07  8:01 PATCH: complete rpm --{resign,addsign} in local Sven Wischnowsky
  -- strict thread matches above, loose matches on Subject: below --
2000-06-06  9:56 Sven Wischnowsky
2000-06-05  8:54 Sven Wischnowsky
2000-06-04 19:37 ` Chmouel Boudjnah
2000-06-04 21:09   ` Clint Adams
2000-06-05  1:13     ` Bart Schaefer
2000-06-05  1:18   ` Bart Schaefer
2000-06-05  9:47     ` Oliver Kiddle
2000-06-05 15:03       ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).