mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 00:45:44 +01:00
improve SubCommand class
This commit is contained in:
@@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user