From: <cr...@us...> - 2008-04-06 15:07:38
|
Revision: 3941 http://jnode.svn.sourceforge.net/jnode/?rev=3941&view=rev Author: crawley Date: 2008-04-06 08:07:36 -0700 (Sun, 06 Apr 2008) Log Message: ----------- Converted DateCommand to use new syntax mechanism, etc Modified Paths: -------------- trunk/shell/descriptors/org.jnode.shell.command.xml trunk/shell/src/shell/org/jnode/shell/command/DateCommand.java Modified: trunk/shell/descriptors/org.jnode.shell.command.xml =================================================================== --- trunk/shell/descriptors/org.jnode.shell.command.xml 2008-04-06 06:26:51 UTC (rev 3940) +++ trunk/shell/descriptors/org.jnode.shell.command.xml 2008-04-06 15:07:36 UTC (rev 3941) @@ -74,6 +74,7 @@ <argument argLabel="classname"/> </sequence> </syntax> + <syntax alias="date" description="print the current date"/> <syntax alias="set"> <sequence description="set a system property"> <argument argLabel="key"/> Modified: trunk/shell/src/shell/org/jnode/shell/command/DateCommand.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/command/DateCommand.java 2008-04-06 06:26:51 UTC (rev 3940) +++ trunk/shell/src/shell/org/jnode/shell/command/DateCommand.java 2008-04-06 15:07:36 UTC (rev 3941) @@ -21,37 +21,36 @@ package org.jnode.shell.command; +import java.io.InputStream; +import java.io.PrintStream; import java.util.Date; -import javax.naming.NameNotFoundException; +import org.jnode.shell.AbstractCommand; +import org.jnode.shell.CommandLine; -import org.jnode.shell.help.Help; - /** * A shell command to access the display the system date. * @author Matt Paine + * @author cr...@jn... */ -public class DateCommand { +public class DateCommand extends AbstractCommand { - public static Help.Info HELP_INFO = new Help.Info( - "date", - "prints the current date" - ); + public DateCommand() { + super("prints the current date"); + } - /** - * Sets up any instance variables and processes the command arguments. - * @param args The arguments to work with. - **/ - public DateCommand(String[] args) throws NameNotFoundException { - System.out.println(new Date()); - } + @Override + public void execute(CommandLine commandLine, InputStream in, + PrintStream out, PrintStream err) throws Exception { + out.println(new Date()); + } - /** - * Displays the system date - * @param args No arguments. - **/ - public static void main(String[] args) throws NameNotFoundException { - new DateCommand(args); - } + /** + * Displays the system date + * @param args No arguments. + **/ + public static void main(String[] args) throws Exception { + new DateCommand().execute(args); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |