5 Replies Latest reply on May 31, 2014 10:36 AM by

    [forge-users]  Writing files with content

      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

      :

       

       

      1. Creates a project

       

      project-new --named test

       

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

       

      1. ####################

       

      1. #  System Properties

       

      1. ####################

       

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

       

      1. ####################

       

      1. #  Datasource

       

      1. ####################

       

      /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 <http://www.antoniogoncalves.org/> |

      Twitter<http://twitter.com/agoncal>

      | LinkedIn <http://www.linkedin.com/in/agoncal> | Paris

      JUG<http://www.parisjug.org/>

      | Devoxx France <http://www.devoxx.fr/>

       

        • 1. Re: [forge-users] Writing files with content

          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

          :

           

          >

          1. Creates a project

           

          project-new --named test

           

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

           

          1. ####################

           

          1. #  System Properties

           

          1. ####################

           

          >

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

           

          1. ####################

           

          1. #  Datasource

           

          1. ####################

           

          /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 <http://www.antoniogoncalves.org/> | Twitter

          <http://twitter.com/agoncal> | LinkedIn

          <http://www.linkedin.com/in/agoncal> | Paris JUG

          <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

           

           

           

           

          --

          Antonio Goncalves

          Software architect and Java Champion

           

          Web site <http://www.antoniogoncalves.org/> | Twitter

          <http://twitter.com/agoncal> | LinkedIn <http://www.linkedin.com/in/agoncal>

          | Paris JUG <http://www.parisjug.org/> | Devoxx France

          <http://www.devoxx.fr/>

           

          • 2. Re: [forge-users] Writing files with content
            George Gastaldi Master

            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

             

            • 3. Re: [forge-users] Writing files with content
              Lincoln Baxter III Master

              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 <http://www.antoniogoncalves.org/> | Twitter

              >> <http://twitter.com/agoncal> | LinkedIn

              >> <http://www.linkedin.com/in/agoncal> | Paris JUG

              >> <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

              >>

              >

              >

              --

              Antonio Goncalves

              Software architect and Java Champion

               

              Web site <http://www.antoniogoncalves.org/> | Twitter

              <http://twitter.com/agoncal> | LinkedIn

              <http://www.linkedin.com/in/agoncal> | Paris JUG

              <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

               

              _______________________________________________

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

               

              • 4. Re: [forge-users] Writing files with content
                Daniel Cunha (soro) Novice

                Lincoln,

                 

                "Most shells use '\' at the end of the line, and I'd like to stay

                conventional if possible."

                 

                +1

                 

                 

                On Fri, May 30, 2014 at 12:41 PM, Lincoln Baxter, III <

                lincolnbaxter@gmail.com> wrote:

                 

                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 <http://www.antoniogoncalves.org/> | Twitter

                >>> <http://twitter.com/agoncal> | LinkedIn

                >>> <http://www.linkedin.com/in/agoncal> | Paris JUG

                >>> <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

                >>>

                >>

                >>

                >>

                >> --

                >> Antonio Goncalves

                >> Software architect and Java Champion

                >>

                >> Web site <http://www.antoniogoncalves.org/> | Twitter

                >> <http://twitter.com/agoncal> | LinkedIn

                >> <http://www.linkedin.com/in/agoncal> | Paris JUG

                >> <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

                >>

                >> _______________________________________________

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

                 

                _______________________________________________

                forge-users mailing list

                forge-users@lists.jboss.org

                https://lists.jboss.org/mailman/listinfo/forge-users

                 

                 

                 

                 

                --

                Att;

                Daniel Cunha (soro)

                 

                • 5. Re: [forge-users] Writing files with content

                  Hum... good idea but 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.

                   

                  I'm creating a JIRA (either to fix something that is not working, or to

                  document it)

                   

                  https://issues.jboss.org/browse/FORGE-1860

                   

                  Antonio

                   

                   

                  2014-05-30 17:15 GMT+02:00 George Gastaldi <ggastald@redhat.com>:

                   

                  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 <http://www.antoniogoncalves.org/> | Twitter

                  >> <http://twitter.com/agoncal> | LinkedIn

                  >> <http://www.linkedin.com/in/agoncal> | Paris JUG

                  >> <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

                  >>

                  >

                  >

                  --

                  Antonio Goncalves

                  Software architect and Java Champion

                   

                  Web site <http://www.antoniogoncalves.org/> | Twitter

                  <http://twitter.com/agoncal> | LinkedIn

                  <http://www.linkedin.com/in/agoncal> | Paris JUG

                  <http://www.parisjug.org/> | Devoxx France <http://www.devoxx.fr/>

                   

                  _______________________________________________

                  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

                   

                   

                   

                   

                  --

                  Antonio Goncalves

                  Software architect and Java Champion

                   

                  Web site <http://www.antoniogoncalves.org/> | Twitter

                  <http://twitter.com/agoncal> | LinkedIn <http://www.linkedin.com/in/agoncal>

                  | Paris JUG <http://www.parisjug.org/> | Devoxx France

                  <http://www.devoxx.fr/>