Skip to content

Commit

Permalink
we all need some harlem from time to time....
Browse files Browse the repository at this point in the history
  • Loading branch information
stalep committed Mar 22, 2013
1 parent 92c22ee commit 9c64d66
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
2 changes: 1 addition & 1 deletion aesh/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<dependency>
<groupId>org.jboss.aesh</groupId>
<artifactId>aesh-extensions</artifactId>
<version>0.34</version>
<version>0.36</version>
</dependency>
<dependency>
<groupId>org.jboss.forge</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2012 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.aesh.commands;

import org.jboss.aesh.console.Console;
import org.jboss.aesh.extensions.harlem.Harlem;
import org.jboss.forge.aesh.ShellContext;
import org.jboss.forge.ui.UICommand;
import org.jboss.forge.ui.context.UIBuilder;
import org.jboss.forge.ui.context.UIContext;
import org.jboss.forge.ui.context.UIValidationContext;
import org.jboss.forge.ui.metadata.UICommandMetadata;
import org.jboss.forge.ui.result.Result;
import org.jboss.forge.ui.result.Results;
import org.jboss.forge.ui.util.Metadata;

/**
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a>
*/
public class HarlemCommand implements UICommand {
@Override
public UICommandMetadata getMetadata() {
return Metadata.forCommand(getClass())
.name("harlem")
.description("do you want some harlem?");
}

@Override
public boolean isEnabled(UIContext context) {
return true;
}

@Override
public void initializeUI(UIBuilder builder) throws Exception {
}

@Override
public void validate(UIValidationContext validator) {
}

@Override
public Result execute(UIContext context) throws Exception {
if(context instanceof ShellContext) {
Console console = ((ShellContext) context).getShell().getConsole();
Harlem harlem = new Harlem(console);
harlem.attach(((ShellContext) context).getConsoleOutput());
}
return Results.success();
}
}

0 comments on commit 9c64d66

Please sign in to comment.