From: <cr...@us...> - 2008-05-03 14:37:31
|
Revision: 4047 http://jnode.svn.sourceforge.net/jnode/?rev=4047&view=rev Author: crawley Date: 2008-05-03 07:37:29 -0700 (Sat, 03 May 2008) Log Message: ----------- Converted ClearConsoleCommand Modified Paths: -------------- trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml trunk/shell/src/shell/org/jnode/shell/command/driver/console/ClearConsoleCommand.java Modified: trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml =================================================================== --- trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml 2008-05-03 14:26:33 UTC (rev 4046) +++ trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml 2008-05-03 14:37:29 UTC (rev 4047) @@ -22,6 +22,12 @@ <alias name="console" class="org.jnode.shell.command.driver.console.ConsoleCommand"/> <alias name="clear" class="org.jnode.shell.command.driver.console.ClearConsoleCommand"/> </extension> + + <extension point="org.jnode.shell.syntaxes"> + <syntax alias="clear"> + <empty description="Clear the console"/> + </syntax> + </extension> <extension point="org.jnode.security.permissions"> <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/> Modified: trunk/shell/src/shell/org/jnode/shell/command/driver/console/ClearConsoleCommand.java =================================================================== --- trunk/shell/src/shell/org/jnode/shell/command/driver/console/ClearConsoleCommand.java 2008-05-03 14:26:33 UTC (rev 4046) +++ trunk/shell/src/shell/org/jnode/shell/command/driver/console/ClearConsoleCommand.java 2008-05-03 14:37:29 UTC (rev 4047) @@ -21,34 +21,40 @@ package org.jnode.shell.command.driver.console; -import javax.naming.NameNotFoundException; +import java.io.InputStream; +import java.io.PrintStream; import org.jnode.driver.console.TextConsole; -import org.jnode.naming.InitialNaming; -import org.jnode.shell.ShellException; -import org.jnode.shell.ShellManager; -import org.jnode.shell.help.Help; -import org.jnode.shell.help.Parameter; -import org.jnode.shell.help.Syntax; +import org.jnode.shell.AbstractCommand; +import org.jnode.shell.CommandLine; +import org.jnode.shell.Shell; +import org.jnode.shell.ShellUtils; /** + * This command clears the console. + * * @author Jacob Kofod */ -public class ClearConsoleCommand { +public class ClearConsoleCommand extends AbstractCommand { - public static Help.Info HELP_INFO = - new Help.Info("clear", new Syntax[] { new Syntax("Clear console screen", new Parameter[] {}), } - ); + public ClearConsoleCommand() { + super("Clear console screen"); + } /** * Clear console screen * * @param args no arguments. */ - public static void main(String[] args) - throws NameNotFoundException, ShellException { - final ShellManager sm = InitialNaming.lookup(ShellManager.NAME); - TextConsole tc = (TextConsole) sm.getCurrentShell().getConsole(); + public static void main(String[] args) throws Exception { + new ClearConsoleCommand().execute(args); + } + + @Override + public void execute(CommandLine commandLine, InputStream in, + PrintStream out, PrintStream err) throws Exception { + final Shell shell = ShellUtils.getCurrentShell(); + TextConsole tc = (TextConsole) shell.getConsole(); tc.clear(); tc.setCursor(0, 0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |