Re: [nant-dev] New task: cat
Hi, * Gert Driesen wrote on 17.09.2003 (07:57): wouldn't it be better to have something similar to the Ant concat task (http://ant.apache.org/manual/CoreTasks/concat.html), which allows files to be concatenated or the tasks inline text be appended (or overwritten) to the destination file ? A fileset is indeed a good idea. Myself I found that it would be nice to have a filtering option, that adds part of the functionality that's in grep. I think of an attribute filter which takes an regular expression. When doing this, I will add fileset support. If a fileset is given the file attribute gets ignored. Hence, I will make it optional.The task won't fail if no input is given. I'll have a look at the echo task to see how inline text ist handled, and see if I put this in the upcoming version. -sa -- sa at programmers-world dot com http://www.livingit.de Bookmarks online: http://www.mobile-bookmarks.info Soon available in english CChheecckk yyoouurr dduupplleexx sswwiittcchh.. --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] New task: cat
There is already a concat task in NAntContrib... And the task already support filesets Nick From: Sascha Andres [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [nant-dev] New task: cat Date: Wed, 17 Sep 2003 09:21:20 +0200 MIME-Version: 1.0 Hi, * Gert Driesen wrote on 17.09.2003 (07:57): wouldn't it be better to have something similar to the Ant concat task (http://ant.apache.org/manual/CoreTasks/concat.html), which allows files to be concatenated or the tasks inline text be appended (or overwritten) to the destination file ? A fileset is indeed a good idea. Myself I found that it would be nice to have a filtering option, that adds part of the functionality that's in grep. I think of an attribute filter which takes an regular expression. When doing this, I will add fileset support. If a fileset is given the file attribute gets ignored. Hence, I will make it optional.The task won't fail if no input is given. I'll have a look at the echo task to see how inline text ist handled, and see if I put this in the upcoming version. -sa -- sa at programmers-world dot com http://www.livingit.de Bookmarks online: http://www.mobile-bookmarks.info Soon available in english CChheecckk yyoouurr dduupplleexx sswwiittcchh.. --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers _ MSN Search, le moteur de recherche qui pense comme vous ! http://fr.ca.search.msn.com/ --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] New task: cat
Sascha, I guess I have this question... Should both these functionalities be combined in a single task? Why not just support two sep. tasks. concat ... .../ / filter .../ That leaves the choice to the user about what they want to do. They can mix and match anyway they want. - Original Message - From: Sascha Andres [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 1:15 PM Subject: Re: [nant-dev] New task: cat Hi, * Sascha Andres wrote on 17.09.2003 (21:56): Perhaps it's time to move it to NAnt.Core? I'll have a look, and see what needs to be done to implement the filter I mentioned earlier. After that, I'll post a patch for that one. I had a look at the concat task. The concat task uses a FileStrem to read and write. So it can handle binary files as well as text files. It has one caveat to transfer this way: It makes it hard to work with a filter using regular expressions. I see the following possibilities: * Add a filter attribute. If set use a StreamReader / StreamWriter combination. I don't really like this one, as this sounds like bad design. * Drop the filter idea. I think a filtering task would be nice to have.- At least when it's done with the power of regular expressions. * Use concat as a binary save cat, rename my cat task to something more regex specific, but leave the cat functionality. Add fileet support, make filter not optional. What do you think? --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
Re: [nant-dev] New task: cat
I agree. Filter should probably be a seperate task. It might be worth looking at Ants filterset concept. http://ant.apache.org/manual/CoreTypes/filterset.html Ian Sascha, I guess I have this question... Should both these functionalities be combined in a single task? Why not just support two sep. tasks. concat ... .../ / filter .../ That leaves the choice to the user about what they want to do. They can mix and match anyway they want. - Original Message - From: Sascha Andres [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 17, 2003 1:15 PM Subject: Re: [nant-dev] New task: cat Hi, * Sascha Andres wrote on 17.09.2003 (21:56): Perhaps it's time to move it to NAnt.Core? I'll have a look, and see what needs to be done to implement the filter I mentioned earlier. After that, I'll post a patch for that one. I had a look at the concat task. The concat task uses a FileStrem to read and write. So it can handle binary files as well as text files. It has one caveat to transfer this way: It makes it hard to work with a filter using regular expressions. I see the following possibilities: * Add a filter attribute. If set use a StreamReader / StreamWriter combination. I don't really like this one, as this sounds like bad design. * Drop the filter idea. I think a filtering task would be nice to have.- At least when it's done with the power of regular expressions. * Use concat as a binary save cat, rename my cat task to something more regex specific, but leave the cat functionality. Add fileet support, make filter not optional. What do you think? --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers --- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf ___ nant-developers mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-developers
[nant-dev] New task: cat
Hi, I had a problem where I merge sourcefiles into one assembly, while I use them normally in more than one assembly to link only what I need. I'm using the ndoc task to document, and hence it's missing the namespace descriptions, if I do not create a new namespace.xml for the merged assembly. Basicly appending all namespace.xml files from the seperated assemblies into one new would do the job. I would do this with cat under unix, but I found it nice to have a task doing this. There are three attributes: * file * pipe * append The last two are optional. The first one is the file to cat. If this is the only attribute given, it will print it on the screen. If pip is given, it will create - that means overwrite, since append defaults to false - the given file and insert the contents of file. If append is true the content is appended where I've reached what I wanted. I just think I post it here for inclusion in NAnt or NAnt-contrib. -sa -- sa at programmers-world dot com http://www.livingit.de Bookmarks online: http://www.mobile-bookmarks.info Soon available in english Life would be so much easier if we could just look at the source code. // NAnt - A .NET build tool // Copyright (C) 2001-2002 Gerry Shaw // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Sascha Andres ([EMAIL PROTECTED]) using System; using System.Globalization; using System.Xml; using System.IO; using NAnt.Core.Attributes; using NAnt.Core.Util; namespace NAnt.Core.Tasks { /// summary /// A somehow compareable task to 'cat' from a unix/linux system /// /summary /// example /// paraPrints a file on the screen/para /// code /// ![CDATA[ /// cat file=input.txt / /// ]] /// /code /// paraPrints a file to an other file. Overwrite is the default!/para /// code /// ![CDATA[ /// cat file=input.txt pipe=output.txt / /// ]] /// /code /// paraPrints two files to one other file./para /// code /// ![CDATA[ /// cat file=input.txt pipe=output.txt / /// cat file=input2.txt pipe=output.txt append=true / /// ]] /// /code /// /example [TaskName(cat)] public class CatTask : Task { #region Private Instance Fields private string _filein = ; private string _fileout = ; private string _append = Boolean.FalseString; #endregion Private Instance Fields #region Public Instance Properties /// summary /// The file to display. /// /summary [TaskAttribute(file, Required=true)] public string File { get { return _filein; } set { _filein = value; } } /// summary /// Write the output to /// /summary [TaskAttribute(pipe, Required=false)] public string Pipe { get { return _fileout; } set { _fileout = value; } } /// summary /// Append to file /// /summary [TaskAttribute(append, Required=false)] [BooleanValidator()] public string Append { get { return _append; } set { _append = value; } } #endregion Public Instance Properties #region Override implementation of Task /// summary /// Outputs the message to the build log. /// /summary protected override void ExecuteTask() { bool bUseFile = false; using (StreamReader sr = new StreamReader(_filein)) { StreamWriter sw = null; if (_fileout != ) { bUseFile = true; sw = new StreamWriter(_fileout, Convert.ToBoolean(_append)); } while(true) { string strLine = sr.ReadLine(); if (strLine == null) { break; } if (!bUseFile) { Log(Level.Info, LogPrefix + strLine); } else { sw.WriteLine(strLine); } } if (bUseFile) {