You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/09/11 20:57:06 UTC
svn commit: r694423 - in /geronimo/gshell/trunk:
gshell-api/src/main/java/org/apache/geronimo/gshell/command/
gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/
gshell-wisdom/gshell-wisdom-core/src/main/java/org...
Author: jdillon
Date: Thu Sep 11 11:57:04 2008
New Revision: 694423
URL: http://svn.apache.org/viewvc?rev=694423&view=rev
Log:
Trying to figure out what to configure for wisdom, for now make name + description configurable
Modified:
geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDocumenter.java
geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
Modified: geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDocumenter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDocumenter.java?rev=694423&r1=694422&r2=694423&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDocumenter.java (original)
+++ geronimo/gshell/trunk/gshell-api/src/main/java/org/apache/geronimo/gshell/command/CommandDocumenter.java Thu Sep 11 11:57:04 2008
@@ -29,18 +29,18 @@
public interface CommandDocumenter
{
/**
- * Get the name of the command as it has been configured in the layout.
+ * Get the name of the command.
*
* @return The configured name of the command.
*/
- String getName(CommandInfo info);
+ String getName();
/**
* Get the terse description of the command.
*
- * @return The configured description of hte command.
+ * @return The configured description of the command.
*/
- String getDescription(CommandInfo info);
+ String getDescription();
/**
* Render the command-line usage, as expected from <tt>--help</tt>.
Modified: geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java?rev=694423&r1=694422&r2=694423&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java (original)
+++ geronimo/gshell/trunk/gshell-commands/gshell-builtins/src/main/java/org/apache/geronimo/gshell/commands/builtins/HelpCommand.java Thu Sep 11 11:57:04 2008
@@ -124,8 +124,7 @@
String name = StringUtils.rightPad(child.getName(), maxNameLen);
CommandDocumenter documenter = command.getContainer().getDocumenter();
- CommandInfo info = command.getInfo();
- String desc = documenter.getDescription(info);
+ String desc = documenter.getDescription();
io.out.print(" ");
io.out.print(renderer.render(Renderer.encode(name, Code.BOLD)));
@@ -191,6 +190,5 @@
log.debug("Rendering help for command: {}", info.getName());
documenter.renderManual(info, io.out);
-
}
}
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java?rev=694423&r1=694422&r2=694423&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandContainerComponentSupport.java Thu Sep 11 11:57:04 2008
@@ -34,11 +34,15 @@
{
protected final Logger log = LoggerFactory.getLogger(getClass());
- protected CommandContainer container;
+ private CommandContainer container;
public void setCommandContainer(final CommandContainer container) {
assert container != null;
this.container = container;
}
+
+ protected CommandContainer getContainer() {
+ return container;
+ }
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java?rev=694423&r1=694422&r2=694423&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java (original)
+++ geronimo/gshell/trunk/gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/command/CommandDocumenterImpl.java Thu Sep 11 11:57:04 2008
@@ -24,11 +24,8 @@
import org.apache.geronimo.gshell.command.CommandAction;
import org.apache.geronimo.gshell.command.CommandDocumenter;
import org.apache.geronimo.gshell.command.CommandInfo;
-import org.apache.geronimo.gshell.command.CommandContainer;
-import org.apache.geronimo.gshell.command.CommandContainerAware;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import javax.annotation.PostConstruct;
import java.io.PrintWriter;
/**
@@ -40,45 +37,36 @@
extends CommandContainerComponentSupport
implements CommandDocumenter
{
- /**
- * Get the action instance for the given command context.
- *
- * @param info The command-info to previde an action for.
- * @return The command action for the given information.
- */
- private CommandAction getAction(final CommandInfo info) {
- assert info != null;
+ //
+ // TODO: Need to provide i18n keys to lookup the values for name & description
+ //
+
+ private String name;
- // TODO:
+ private String description;
- throw new Error("Not implemented");
+ public String getName() {
+ return name;
}
- // CommandDocumenter
-
- public String getName(final CommandInfo info) {
- assert info != null;
-
- // Use the alias if we have one, else use the command name
- String name = info.getAlias();
- if (name == null) {
- name = info.getName();
- }
-
- return name;
+ public void setName(final String name) {
+ this.name = name;
}
- public String getDescription(final CommandInfo info) {
- assert info != null;
+ public String getDescription() {
+ return description;
+ }
- // TODO:
-
- throw new Error("Not implemented");
+ public void setDescription(final String description) {
+ this.description = description;
}
- //
- // TODO: Add some nice ANSI muck
- //
+ @PostConstruct
+ public void init() {
+ // TODO: Validate
+ }
+
+ // CommandDocumenter
public void renderUsage(final CommandInfo info, final PrintWriter out) {
assert info != null;
@@ -91,12 +79,16 @@
clp.addBean(help);
// And then the beans options
- CommandAction action = getAction(info);
+ CommandAction action = getContainer().getAction();
clp.addBean(action);
// Fetch the details
- String name = getName(info);
- String desc = getDescription(info);
+ String name = getName();
+ String desc = getDescription();
+
+ //
+ // TODO: Add some nice ANSI muck
+ //
// Render the help
out.println(desc);