Ian, if there were no side-effects to initializing the build file(s), i'd say "why not", but it seems it's a little more complex than that -- you'd want to process <property> and <include> but no other project-level task, then show the target list. so, is it worth your while? also, wouldn't we still want an xslt layer to better control the output format?
/jean > > Should the -projecthelp option do the same thing by default ? > Rightnow > it uses xslt to process the build file - ie it doesn't actually > load/Initialize the project. > > Ian > > >i'm looking in NAnt.core source code to figure this out. > > > >Project has TargetCollection called Targets > >TargetCollection contains Target > >Target has properties .Name, .Desc, .... > > > > > > <target name="showTargets" > > > <echo message="Here are the available targets in this > project and > >its includes:" /> > > <script language="C#"> > > <code><![CDATA[ > > public static void ScriptMain(Project project) { > > foreach( Target t in project.Targets ) > > { > > Console.WriteLine( t.Name ); > > Console.WriteLine( " " + t.Desc); > > } > > } > > ]]></code> > > </script> > > </target> > > > > > > > > > > > >>-----Original Message----- > >>From: Narayanasamy, Sundar > [mailto:[EMAIL PROTECTED] > >>Sent: Monday, September 15, 2003 19:07 > >>To: [EMAIL PROTECTED]; [EMAIL PROTECTED] > >>Subject: RE: [Nant-users] How to list available targets? > >> > >> > >>Fabulous. That's what I've been looking for. How could I get > >>the descriptions along with that? > >> > >>Thanks, > >>Sundar > >> > >>-----Original Message----- > >>From: Jean Rajotte [mailto:[EMAIL PROTECTED] > >>Sent: Monday, September 15, 2003 3:23 PM > >>To: [EMAIL PROTECTED] > >>Subject: RE: [Nant-users] How to list available targets? > >> > >> > >>good point about includes. > >>here's a target that lists all loaded targets > >>so, to invoke it you'd say: >nant showTargets > >> > >> <target name="showTargets" > > >> <echo message="Here are the available targets in this > >>project and its includes:" /> > >> <script language="C#"> > >> <code><![CDATA[ > >> public static void ScriptMain(Project project) { > >> foreach( Target t in project.Targets ) > >> Console.WriteLine( t.Name ); > >> } > >> ]]></code> > >> </script> > >> </target> > >> > >> > >> > >>>-----Original Message----- > >>>From: [EMAIL PROTECTED] > >>>[mailto:[EMAIL PROTECTED] On Behalf Of > >>>Randy Regnier > >>>Sent: Monday, September 15, 2003 17:52 > >>>To: 'Erv Walter'; 'Narayanasamy, Sundar'; 'Jaroslaw > >>>Kowalski'; [EMAIL PROTECTED] > >>>Subject: RE: [Nant-users] How to list available targets? > >>> > >>> > >>>It will return all of the targets in the main/default > build file, but > >>>if that build file includes files with additional targets, those > >>>included targets are not listed. > >>> > >>>I'll leave it to others to decide if this is a feature or > a bug. :-) > >>> > >>>Randy > >>> > >>>-----Original Message----- > >>>From: [EMAIL PROTECTED] > >>>[mailto:[EMAIL PROTECTED] On Behalf Of Erv > >>>Walter > >>>Sent: Monday, September 15, 2003 4:24 PM > >>>To: Narayanasamy, Sundar; Jaroslaw Kowalski; > >>>[EMAIL PROTECTED] > >>>Subject: RE: [Nant-users] How to list available targets? > >>> > >>> > >>>If you type "nant -projecthelp" you will get exactly what you want. > >>> > >>>-----Original Message----- > >>>From: Narayanasamy, Sundar > >>> > >>> > >>[mailto:[EMAIL PROTECTED] > >> > >> > >>>Sent: Monday, September 15, 2003 1:58 PM > >>>To: Jaroslaw Kowalski; [EMAIL PROTECTED] > >>>Subject: RE: [Nant-users] How to list available targets? > >>> > >>>Let me re-phrase the question. > >>> > >>>I need to let the user know of my targets. When user enters "nant > >>>targets" in my project directory, I want to list all the available > >>>targets in my build file. > >>> > >>>Sundar > >>> > >>>-----Original Message----- > >>>From: Jaroslaw Kowalski [mailto:[EMAIL PROTECTED] > >>>Sent: Monday, September 15, 2003 11:50 AM > >>>To: Narayanasamy, Sundar; [EMAIL PROTECTED] > >>>Subject: Re: [Nant-users] How to list available targets? > >>> > >>> > >>>nant -projecthelp > >>> > >>>Also, when your targets have "description" attribute it will be > >>>printed as well. > >>> > >>>There's also NAntMenu shell extension which provides this > information > >>>when you right-click on *.nant file. > >>> > >>>Jarek > >>> > >>>----- Original Message ----- > >>>From: "Narayanasamy, Sundar" <[EMAIL PROTECTED]> > >>>To: <[EMAIL PROTECTED]> > >>>Sent: Monday, September 15, 2003 8:46 PM > >>>Subject: [Nant-users] How to list available targets? > >>> > >>> > >>> > >>> > >>>>Hello, > >>>> > >>>>I have a build file that has several targets? How do I > >>>> > >>>> > >>let the user > >> > >> > >>>know > >>>of the targets, when he tries it. > >>> > >>> > >>>>Help is appreciated. > >>>>Sundar > >>>> > >>>> > >>>>------------------------------------------------------- > >>>>This sf.net email is sponsored by:ThinkGeek > >>>>Welcome to geek heaven. > >>>>http://thinkgeek.com/sf > >>>>_______________________________________________ > >>>>Nant-users mailing list > >>>>[EMAIL PROTECTED] > >>>>https://lists.sourceforge.net/lists/listinfo/nant-users > >>>> > >>>> > >>>> > >>> > >>>------------------------------------------------------- > >>>This sf.net email is sponsored by:ThinkGeek > >>>Welcome to geek heaven. > >>>http://thinkgeek.com/sf > >>>_______________________________________________ > >>>Nant-users mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/nant-users > >>> > >>> > >>>------------------------------------------------------- > >>>This sf.net email is sponsored by:ThinkGeek > >>>Welcome to geek heaven. > >>>http://thinkgeek.com/sf > >>>_______________________________________________ > >>>Nant-users mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/nant-users > >>> > >>> > >>> > >>> > >>>------------------------------------------------------- > >>>This sf.net email is sponsored by:ThinkGeek > >>>Welcome to geek heaven. > >>>http://thinkgeek.com/sf > >>>_______________________________________________ > >>>Nant-users mailing list > >>>[EMAIL PROTECTED] > >>>https://lists.sourceforge.net/lists/listinfo/nant-users > >>> > >>> > >>> > >> > >>------------------------------------------------------- > >>This sf.net email is sponsored by:ThinkGeek > >>Welcome to geek heaven. > >>http://thinkgeek.com/sf > >>_______________________________________________ > >>Nant-users mailing list > >>[EMAIL PROTECTED] > >>https://lists.sourceforge.net/lists/listinfo/n> ant-users > >> > >> > >> > > > > > > > >------------------------------------------------------- > >This sf.net email is sponsored by:ThinkGeek > >Welcome to geek heaven. > >http://thinkgeek.com/sf > _______________________________________________ > >Nant-users mailing list > >[EMAIL PROTECTED] > >https://lists.sourceforge.net/lists/listinfo/nant-users > > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Nant-users mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/n> ant-users > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users