improve SubCommand class

This commit is contained in:
Sebastian Sdorra
2011-05-18 21:38:10 +02:00
parent c18c210e4d
commit edc5b78813
2 changed files with 19 additions and 4 deletions

View File

@@ -33,6 +33,15 @@
package sonia.scm.cli; package sonia.scm.cli;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.client.ScmClientSession;
import sonia.scm.repository.Repository;
//~--- JDK imports ------------------------------------------------------------
import java.util.List;
/** /**
* *
* @author Sebastian Sdorra * @author Sebastian Sdorra
@@ -48,6 +57,12 @@ public class ListRepositoriesSubCommand extends SubCommand
@Override @Override
protected void run() protected void run()
{ {
output.println( "list-repositoies" ); ScmClientSession session = createSession();
List<Repository> repositories = session.getRepositoryHandler().getAll();
for (Repository r : repositories)
{
output.println(r);
}
} }
} }

View File

@@ -198,9 +198,6 @@ public abstract class SubCommand
/** Field description */ /** Field description */
protected PrintWriter output; protected PrintWriter output;
/** Field description */
protected ScmClientSession session;
/** Field description */ /** Field description */
@Option( @Option(
name = "--help", name = "--help",
@@ -208,4 +205,7 @@ public abstract class SubCommand
aliases = { "-h" } aliases = { "-h" }
) )
private boolean help = false; private boolean help = false;
/** Field description */
private ScmClientSession session;
} }