Sorry Antonio. I've been out at a week long meeting.

I think George's solution using stream redirection should work. The only question I have about it is multi-line support. I think your example is somewhat unconventional. Most shells use '\' at the end of the line, and I'd like to stay conventional if possible.

~Lincoln


On Fri, May 30, 2014 at 11:15 AM, George Gastaldi <ggastald@redhat.com> wrote:
I think piping to a file would be more intuitive and it should work now:

Eg:
echo Hi > a.txt

cat file.txt>anotherfile.txt

Em 30/05/2014, às 11:36, Antonio Goncalves <antonio.mailing@gmail.com> escreveu:

No feedback on this feature ? I feel it could fill many of my gaps. Nobody else sees any need ?


2014-05-25 18:02 GMT+02:00 Antonio Goncalves <antonio.mailing@gmail.com>:
Hi all,

I see myself adding files here and there on my projects (JBoss cli commands, shell scripts, SQL scripts...) and I use the touch command in Forge extensively. But how could I add content to these files ? I mostly write Forge scripts, so I would love to do something like that in my script :


# Creates a project

project-new --named test

# Adds a few extra files and directories

mkdir src/main/script ;
touch src/main/resources/insert.sql ; // This creates an empty file

touch src/main/script/wildfly-show.cli --content (((( // This adds content to the file

version

# ####################

# #  System Properties

# ####################

/core-service=platform-mbean/type=runtime:read-attribute(name=system-properties)

# ####################

# #  Datasource

# ####################

/subsystem=datasources/data-source=ApplicationBlancheH2DS:read-resource

/subsystem=datasources/data-source=ApplicationBlancheH2DS:test-connection-in-pool

/subsystem=datasources/data-source=ApplicationBlancheOracleDS:read-resource

/subsystem=datasources/data-source=ApplicationBlancheOracleDS:test-connection-in-pool

/subsystem=datasources/jdbc-driver=oracle:read-resource

))))


And this command would just create a file with the previous content in it. As you can see, this can be tricky : when to end the content of a file (something similar to <![CDATA[]]>)

What do you think ? Any idea to integrate this feature smoothly in Forge ?


--
Antonio Goncalves 
Software architect and Java Champion

Web site | Twitter | LinkedIn | Paris JUG | Devoxx France



--
Antonio Goncalves 
Software architect and Java Champion

Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
_______________________________________________
forge-users mailing list
forge-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-users

_______________________________________________
forge-users mailing list
forge-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-users



--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."