[forge-issues] [JBoss JIRA] (FORGE-1860) Writing files with content
Robert Balent (JIRA)
issues at jboss.org
Sun Jun 1 17:45:16 EDT 2014
[ https://issues.jboss.org/browse/FORGE-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972222#comment-12972222 ]
Robert Balent commented on FORGE-1860:
--------------------------------------
">" , ">>" and other operators were not writing to files in the actual working directory. This is now resolved in Aesh 0.56-SNAPSHOT.
> Writing files with content
> --------------------------
>
> Key: FORGE-1860
> URL: https://issues.jboss.org/browse/FORGE-1860
> Project: Forge
> Issue Type: Feature Request
> Components: UI - Shell
> Affects Versions: 2.6.0.Final
> Reporter: Antonio Goncalves
> Fix For: 2.x Future
>
>
> 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 :
> {code}
> # 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
> ))))
> {code}
> 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[]]>)
> George mentioned on the mailing list :
> ??I think piping to a file would be more intuitive and it should work now:??
> {code}
> echo Hi > a.txt
> {code}
> The problem with this, is I can't make it work the way I want. In fact, each time I do a {{echo text > file.txt}}, the {{file.txt}} is created in the directory below, not the current one. As I can't create a file in another directory.
> {code}
> [Devoxx]$ ls
> [Devoxx]$ project-new --named testecho
> ***SUCCESS*** Project named 'testecho' has been created.
> [testecho]$ ls
> pom.xml src
> [testecho]$ echo Text to add to this new file > newfile.txt
> [testecho]$ ls
> pom.xml src
> [testecho]$ cd ..
> [Devoxx]$ ls
> newfile.txt testecho
> [Devoxx]$
> [testecho]$ echo One test again > ./file.txt
> [testecho]$ ls
> pom.xml src
> {code}
--
This message was sent by Atlassian JIRA
(v6.2.3#6260)
More information about the forge-issues
mailing list