Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 97571 invoked from network); 11 Aug 2009 07:26:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Aug 2009 07:26:34 -0000 Received: (qmail 2645 invoked by uid 500); 11 Aug 2009 07:26:41 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 2618 invoked by uid 500); 11 Aug 2009 07:26:41 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 2609 invoked by uid 99); 11 Aug 2009 07:26:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 07:26:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Aug 2009 07:26:37 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 97F1123888AD; Tue, 11 Aug 2009 07:26:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r803011 - in /felix/trunk/karaf/gshell: gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java Date: Tue, 11 Aug 2009 07:26:16 -0000 To: commits@felix.apache.org From: gnodet@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090811072616.97F1123888AD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gnodet Date: Tue Aug 11 07:26:16 2009 New Revision: 803011 URL: http://svn.apache.org/viewvc?rev=803011&view=rev Log: FELIX-1468: wrapper:install and admin:create prints old ansi output that need to be converted to real ansi Modified: felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java felix/trunk/karaf/gshell/gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java Modified: felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java?rev=803011&r1=803010&r2=803011&view=diff ============================================================================== --- felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java (original) +++ felix/trunk/karaf/gshell/gshell-admin/src/main/java/org/apache/felix/karaf/gshell/admin/internal/AdminServiceImpl.java Tue Aug 11 07:26:16 2009 @@ -34,6 +34,7 @@ import org.osgi.service.prefs.PreferencesService; import org.slf4j.LoggerFactory; import org.slf4j.Logger; +import org.fusesource.jansi.Ansi; public class AdminServiceImpl implements AdminService { @@ -173,7 +174,7 @@ private void copyResourceToDir(File target, String resource, boolean text) throws Exception { File outFile = new File(target, resource); if( !outFile.exists() ) { - println("Creating file: @|bold " + outFile.getPath() + "|"); + println(Ansi.ansi().a("Creating file: ").a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString()); InputStream is = getClass().getClassLoader().getResourceAsStream("/org/apache/felix/karaf/gshell/admin/" + resource); try { if( text ) { @@ -213,7 +214,7 @@ private void copyFilteredResourceToDir(File target, String resource, HashMap props) throws Exception { File outFile = new File(target, resource); if( !outFile.exists() ) { - println("Creating file: @|bold "+outFile.getPath()+"|"); + println(Ansi.ansi().a("Creating file: ").a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString()); InputStream is = getClass().getClassLoader().getResourceAsStream("/org/apache/felix/karaf/gshell/admin/" + resource); try { // Read it line at a time so that we can use the platform line ending when we write it out. @@ -269,7 +270,7 @@ private void mkdir(File serviceMixBase, String path) { File file = new File(serviceMixBase, path); if( !file.exists() ) { - println("Creating dir: @|bold "+file.getPath()+"|"); + println(Ansi.ansi().a("Creating dir: ").a(Ansi.Attribute.INTENSITY_BOLD).a(file.getPath()).a(Ansi.Attribute.RESET).toString()); file.mkdirs(); } } Modified: felix/trunk/karaf/gshell/gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java URL: http://svn.apache.org/viewvc/felix/trunk/karaf/gshell/gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java?rev=803011&r1=803010&r2=803011&view=diff ============================================================================== --- felix/trunk/karaf/gshell/gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java (original) +++ felix/trunk/karaf/gshell/gshell-wrapper/src/main/java/org/apache/felix/karaf/gshell/wrapper/InstallCommand.java Tue Aug 11 07:26:16 2009 @@ -29,6 +29,7 @@ import org.apache.felix.karaf.gshell.console.OsgiCommandSupport; import org.apache.felix.gogo.commands.Option; import org.apache.felix.gogo.commands.Command; +import org.fusesource.jansi.Ansi; /** * Installs this Karaf instance as a service in your operating systems. @@ -41,10 +42,13 @@ @Option(name="-n", aliases={"--name"}, description="The service name that will be used when installing the service.") private String name="karaf"; + @Option(name="-d", aliases={"--display"}, description="The display name of the service.") private String displayName; + @Option(name="-D", aliases={"--description"}, description="The description of the service.") private String description=""; + @Option(name="-s", aliases={"--start-type"}, description="Mode in which the service is installed. AUTO_START or DEMAND_START") private String startType="AUTO_START"; @@ -119,7 +123,8 @@ copyFilteredResourceTo(wrapperConf, "all/karaf-wrapper.conf", props); System.out.println(""); - System.out.println("Setup complete. You may want to tweak the JVM properties in the wrapper configuration file: "+wrapperConf.getPath()); + System.out.println("Setup complete. You may want to tweak the JVM properties in the wrapper configuration file:"); + System.out.println("\t" + wrapperConf.getPath()); System.out.println("before installing and starting the service."); System.out.println(""); if( os.startsWith("Win") ) { @@ -155,7 +160,7 @@ // TODO: figure out if we can detect the Linux flavor System.out.println(""); - System.out.println("@|cyan On Redhat/Fedora/CentOS Systems:|"); + System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("On Redhat/Fedora/CentOS Systems:").a(Ansi.Attribute.RESET).toString()); System.out.println(" To install the service:"); System.out.println(" $ ln -s "+serviceFile.getPath()+" /etc/init.d/"); System.out.println(" $ chkconfig "+serviceFile.getName()+" --add"); @@ -177,7 +182,7 @@ System.out.println(" $ rm /etc/init.d/"+serviceFile.getName()); System.out.println(""); - System.out.println("@|cyan On Ubuntu/Debian Systems:|"); + System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("On Ubuntu/Debian Systems:").a(Ansi.Attribute.RESET).toString()); System.out.println(" To install the service:"); System.out.println(" $ ln -s "+serviceFile.getPath()+" /etc/init.d/"); System.out.println(""); @@ -222,7 +227,8 @@ private void copyResourceTo(File outFile, String resource, boolean text) throws Exception { if( !outFile.exists() ) { - System.out.println("Creating file: @|green "+outFile.getPath()+"|"); + System.out.println(Ansi.ansi().a("Creating file: ") + .a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString()); InputStream is = InstallCommand.class.getResourceAsStream(resource); try { if( text ) { @@ -254,13 +260,16 @@ safeClose(is); } } else { - System.out.println("@|red File allready exists|. Move it out of the way if you want it re-created: "+outFile.getPath()+""); + System.out.println(Ansi.ansi() + .fg(Ansi.Color.RED).a("File already exists").a(Ansi.Attribute.RESET) + .a(". Move it out of the way if you want it re-created: ").a(outFile.getPath()).toString()); } } private void copyFilteredResourceTo(File outFile, String resource, HashMap props) throws Exception { if( !outFile.exists() ) { - System.out.println("Creating file: @|green "+outFile.getPath()+"|"); + System.out.println(Ansi.ansi().a("Creating file: ") + .a(Ansi.Attribute.INTENSITY_BOLD).a(outFile.getPath()).a(Ansi.Attribute.RESET).toString()); InputStream is = InstallCommand.class.getResourceAsStream(resource); try { // Read it line at a time so that we can use the platform line ending when we write it out. @@ -279,7 +288,9 @@ safeClose(is); } } else { - System.out.println("@|red File allready exists|. Move it out of the way if you want it re-created: "+outFile.getPath()+""); + System.out.println(Ansi.ansi() + .fg(Ansi.Color.RED).a("File already exists").a(Ansi.Attribute.RESET) + .a(". Move it out of the way if you want it re-created: ").a(outFile.getPath()).toString()); } } @@ -315,7 +326,8 @@ private void mkdir(File file) { if( !file.exists() ) { - System.out.println("Creating missing directory: @|green "+file.getPath()+"|"); + System.out.println(Ansi.ansi().a("Creating missing directory: ") + .a(Ansi.Attribute.INTENSITY_BOLD).a(file.getPath()).a(Ansi.Attribute.RESET).toString()); file.mkdirs(); } }