zsh-users
 help / color / mirror / code / Atom feed
* Completing directories with special suffix
@ 2002-03-27 21:52 Will Sargent
  2002-03-27 21:57 ` Will Sargent
  2002-03-28  9:59 ` Brian Agnew
  0 siblings, 2 replies; 6+ messages in thread
From: Will Sargent @ 2002-03-27 21:52 UTC (permalink / raw)
  To: zsh-users

Hello all,

I'm trying to get the zsh code completion to expand out java directories and
application modules so that I have directory completion set up with the dot
instead of the slash.

As an example, I'd like to be able to do with java and a directory
/com/foo/bar containing a file Main.class

   java -classpath . com.foo.bar.Main

using the dot prefix to expand on com.f<tab>, if that makes any sense.

I also use ATG Dynamo heavily, so which uses application modules in the same
style.  I have a script for this, but it still expands things out with the /
tag.  It's almost what I want, but not quite; I'd also like it so that only
directories which contain a META-INF directory are considered.

So given a directory structure

    $DYNAMO_ROOT/
		DAS/
			META-INF/
			LDAP/
				META-INF/
				iPlanetDirectory/
					META-INF/
		DPS/
			META-INF/
		home/
			no meta inf dir here/

Then

  startDynamo -m DAS.LDAP.iPlanetDirectory

would be expanded out, but home wouldn't be on the possible list, and DPS
wouldn't have any child completions.

I've created a file called _modules with the following text

#autoload

# Because of the way that the files options are processed, need to pass in
# DYNAMO_ROOT and not $DYNAMO_HOME/..

# We also want to find files which contain a META-INF directory.
# We also want to be able to expand out sub-modules.

DYNAMO_ROOT=$DYNAMO_HOME/..

_files -/ -W DYNAMO_ROOT

but that's as far as I've gotten for now.

What should I change to get the code working like I want?

Will.




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

* RE: Completing directories with special suffix
  2002-03-27 21:52 Completing directories with special suffix Will Sargent
@ 2002-03-27 21:57 ` Will Sargent
  2002-03-28  9:59 ` Brian Agnew
  1 sibling, 0 replies; 6+ messages in thread
From: Will Sargent @ 2002-03-27 21:57 UTC (permalink / raw)
  To: Will Sargent, zsh-users

> As an example, I'd like to be able to do with java and a
> directory /com/foo/bar containing a file Main.class
>
>    java -classpath . com.foo.bar.Main
>
> using the dot prefix to expand on com.f<tab>, if that makes any sense.

And of course, two seconds I send that I find that there's already a java
completion.  Duh.

I'll look at that and see if I can scavange some code.

Will.


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

* Re: Completing directories with special suffix
  2002-03-27 21:52 Completing directories with special suffix Will Sargent
  2002-03-27 21:57 ` Will Sargent
@ 2002-03-28  9:59 ` Brian Agnew
  2002-03-28 18:51   ` Will Sargent
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Agnew @ 2002-03-28  9:59 UTC (permalink / raw)
  To: Will Sargent, zsh-users

I solved this in a non-zsh fashion by writing a program called classfind that
parsed my classpath and built a cache of classes vs. package/directory.

So I can identify which jar I pick up a particular class from.

I then built a zsh completion around it, such that this program was invoked for
 'java com.oopsconsultancy.<TAB>'. So it doesn't complete on directories, but
from your classpath.

More details if you're interested.

Brian

 --- Will Sargent <wsargent@atg.com> wrote: > Hello all,
> 
> I'm trying to get the zsh code completion to expand out java directories and
> application modules so that I have directory completion set up with the dot
> instead of the slash.
> 
> As an example, I'd like to be able to do with java and a directory
> /com/foo/bar containing a file Main.class
> 
>    java -classpath . com.foo.bar.Main
> 
> using the dot prefix to expand on com.f<tab>, if that makes any sense.
> 
> I also use ATG Dynamo heavily, so which uses application modules in the same
> style.  I have a script for this, but it still expands things out with the /
> tag.  It's almost what I want, but not quite; I'd also like it so that only
> directories which contain a META-INF directory are considered.
> 
> So given a directory structure
> 
>     $DYNAMO_ROOT/
> 		DAS/
> 			META-INF/
> 			LDAP/
> 				META-INF/
> 				iPlanetDirectory/
> 					META-INF/
> 		DPS/
> 			META-INF/
> 		home/
> 			no meta inf dir here/
> 
> Then
> 
>   startDynamo -m DAS.LDAP.iPlanetDirectory
> 
> would be expanded out, but home wouldn't be on the possible list, and DPS
> wouldn't have any child completions.
> 
> I've created a file called _modules with the following text
> 
> #autoload
> 
> # Because of the way that the files options are processed, need to pass in
> # DYNAMO_ROOT and not $DYNAMO_HOME/..
> 
> # We also want to find files which contain a META-INF directory.
> # We also want to be able to expand out sub-modules.
> 
> DYNAMO_ROOT=$DYNAMO_HOME/..
> 
> _files -/ -W DYNAMO_ROOT
> 
> but that's as far as I've gotten for now.
> 
> What should I change to get the code working like I want?
> 
> Will.
> 
> 
> 

=====
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian@oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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

* RE: Completing directories with special suffix
  2002-03-28  9:59 ` Brian Agnew
@ 2002-03-28 18:51   ` Will Sargent
  2002-03-29  0:52     ` Brian Agnew
  0 siblings, 1 reply; 6+ messages in thread
From: Will Sargent @ 2002-03-28 18:51 UTC (permalink / raw)
  To: Brian Agnew, zsh-users

> I solved this in a non-zsh fashion by writing a program called
> classfind that
> parsed my classpath and built a cache of classes vs. package/directory.
>
> So I can identify which jar I pick up a particular class from.
>
> I then built a zsh completion around it, such that this program
> was invoked for
>  'java com.oopsconsultancy.<TAB>'. So it doesn't complete on
> directories, but
> from your classpath.
>
> More details if you're interested.

That sounds like a great idea; parse out the classpath and then do
completion on it.  Woo.

Will.




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

* RE: Completing directories with special suffix
  2002-03-28 18:51   ` Will Sargent
@ 2002-03-29  0:52     ` Brian Agnew
  2002-03-29  2:36       ` Will Sargent
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Agnew @ 2002-03-29  0:52 UTC (permalink / raw)
  To: zsh-users

I don't parse out the classpath. Rather I perform the completion function, and
generate the possible package names (and cache them for later use). So I can
complete on a classpath setting (including .zips and .jars) rather than on a
directory basis. Which is what you really want.

Don't know yet if the zsh 4.x completions handle this. Unfortunately my current
client is stuck on 3.x at the moment :-( Hopefully I can check this out next
week.

Brian

 --- Will Sargent <wsargent@atg.com> wrote: > > I solved this in a non-zsh
fashion by writing a program called
> > classfind that
> > parsed my classpath and built a cache of classes vs. package/directory.
> >
> > So I can identify which jar I pick up a particular class from.
> >
> > I then built a zsh completion around it, such that this program
> > was invoked for
> >  'java com.oopsconsultancy.<TAB>'. So it doesn't complete on
> > directories, but
> > from your classpath.
> >
> > More details if you're interested.
> 
> That sounds like a great idea; parse out the classpath and then do
> completion on it.  Woo.
> 
> Will.
> 
> 
> 

=====
Brian Agnew                  http://www.oopsconsultancy.com
OOPS Consultancy Ltd         brian@oopsconsultancy.com
Tel: +44 (0)7720 397526
Fax: +44 (0)20 8682 0012

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com


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

* RE: Completing directories with special suffix
  2002-03-29  0:52     ` Brian Agnew
@ 2002-03-29  2:36       ` Will Sargent
  0 siblings, 0 replies; 6+ messages in thread
From: Will Sargent @ 2002-03-29  2:36 UTC (permalink / raw)
  To: Brian Agnew, zsh-users

> I don't parse out the classpath. Rather I perform the completion
> function, and
> generate the possible package names (and cache them for later
> use). So I can
> complete on a classpath setting (including .zips and .jars)
> rather than on a
> directory basis. Which is what you really want.
>
> Don't know yet if the zsh 4.x completions handle this.
> Unfortunately my current
> client is stuck on 3.x at the moment :-( Hopefully I can check
> this out next
> week.

Yeah, that was what I meant.

Do you do completion in place, so you can define a classpath and expand out
the package in the same line?  Something along the lines of

java -cp jedit.jar org.gjt.jedit.JEdit

would be supercool.

Will.


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

end of thread, other threads:[~2002-03-29  2:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-27 21:52 Completing directories with special suffix Will Sargent
2002-03-27 21:57 ` Will Sargent
2002-03-28  9:59 ` Brian Agnew
2002-03-28 18:51   ` Will Sargent
2002-03-29  0:52     ` Brian Agnew
2002-03-29  2:36       ` Will Sargent

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).