1 26 27 package org.objectweb.util.cmdline.lib; 28 29 import org.objectweb.util.cmdline.api.OptionApplication; 31 import org.objectweb.util.cmdline.api.Application; 32 33 41 42 public class DefaultOptionVersion 43 extends DefaultOptionBase 44 implements OptionApplication 45 { 46 52 53 Application application_; 54 55 61 66 public 67 DefaultOptionVersion(Application application) 68 { 69 super(new String [] { "--version"}, 71 new String [0], 72 "Output version information and exit"); 73 74 application_ = application; 76 } 77 78 84 90 97 public void 98 consume(org.objectweb.util.cmdline.api.Iterator iterator) 99 { 100 java.io.PrintStream output = application_.getConsole().getOutputStream(); 102 103 String [] versionInformation = application_.getVersionInformation(); 105 106 for(int i=0; i<versionInformation.length; i++) 108 output.println(versionInformation[i]); 109 110 System.exit(0); 112 } 113 114 120 125 public Application 126 getApplication() 127 { 128 return application_; 129 } 130 131 136 public void 137 setApplication(Application application) 138 { 139 application_ = application; 140 } 141 142 148 } 154 | Popular Tags |