mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
added groups for subcommands
This commit is contained in:
@@ -152,15 +152,7 @@ public class App
|
|||||||
|
|
||||||
if ((args.length == 0) || (subcommand == null) || help)
|
if ((args.length == 0) || (subcommand == null) || help)
|
||||||
{
|
{
|
||||||
parser.printUsage(output, i18n.getBundle());
|
printHelp(parser, i18n);
|
||||||
output.println();
|
|
||||||
output.println(i18n.getMessage(I18n.SUBCOMMANDS_TITLE));
|
|
||||||
|
|
||||||
for (CommandDescriptor desc :
|
|
||||||
SubCommandHandler.getInstance().getDescriptors())
|
|
||||||
{
|
|
||||||
output.append(" ").println(desc.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -199,6 +191,37 @@ public class App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param parser
|
||||||
|
* @param i18n
|
||||||
|
*/
|
||||||
|
private void printHelp(CmdLineParser parser, I18n i18n)
|
||||||
|
{
|
||||||
|
parser.printUsage(output, i18n.getBundle());
|
||||||
|
output.println();
|
||||||
|
output.println(i18n.getMessage(I18n.SUBCOMMANDS_TITLE));
|
||||||
|
output.println();
|
||||||
|
|
||||||
|
String group = null;
|
||||||
|
|
||||||
|
for (CommandDescriptor desc :
|
||||||
|
SubCommandHandler.getInstance().getDescriptors())
|
||||||
|
{
|
||||||
|
if ((group == null) ||!group.equals(desc.getGroup()))
|
||||||
|
{
|
||||||
|
output.println();
|
||||||
|
group = desc.getGroup();
|
||||||
|
output.append(i18n.getMessage(group)).println(":");
|
||||||
|
output.println();
|
||||||
|
}
|
||||||
|
|
||||||
|
output.append(" ").println(desc.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("add-members")
|
@Command(name = "add-members", group = "group")
|
||||||
public class AddMembersSubCommand extends MembersSubCommand
|
public class AddMembersSubCommand extends MembersSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("add-permission")
|
@Command(name="add-permission", group="repository")
|
||||||
public class AddPermissionSubCommand extends PermissionSubCommand
|
public class AddPermissionSubCommand extends PermissionSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import java.lang.annotation.RetentionPolicy;
|
|||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Command
|
public @interface Command
|
||||||
{
|
{
|
||||||
String value() default "";
|
String name() default "";
|
||||||
String usage() default "";
|
String usage() default "";
|
||||||
|
String group() default "misc";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ public class CommandDescriptor implements Comparable<CommandDescriptor>
|
|||||||
|
|
||||||
if (cmd != null)
|
if (cmd != null)
|
||||||
{
|
{
|
||||||
this.name = cmd.value();
|
this.name = cmd.name();
|
||||||
|
this.group = cmd.group();
|
||||||
this.usage = cmd.usage();
|
this.usage = cmd.usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +109,14 @@ public class CommandDescriptor implements Comparable<CommandDescriptor>
|
|||||||
@Override
|
@Override
|
||||||
public int compareTo(CommandDescriptor desc)
|
public int compareTo(CommandDescriptor desc)
|
||||||
{
|
{
|
||||||
return name.compareTo(desc.name);
|
int result = group.compareTo(desc.group);
|
||||||
|
|
||||||
|
if (result == 0)
|
||||||
|
{
|
||||||
|
result = name.compareTo(desc.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -147,6 +155,17 @@ public class CommandDescriptor implements Comparable<CommandDescriptor>
|
|||||||
return commandClass;
|
return commandClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getGroup()
|
||||||
|
{
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -174,6 +193,9 @@ public class CommandDescriptor implements Comparable<CommandDescriptor>
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
private Class<? extends SubCommand> commandClass;
|
private Class<? extends SubCommand> commandClass;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String group = "misc";
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("create-group")
|
@Command(name="create-group", group="group")
|
||||||
public class CreateGroupSubCommand extends TemplateSubCommand
|
public class CreateGroupSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("create-repository")
|
@Command(name="create-repository",group="repository")
|
||||||
public class CreateRepositorySubCommand extends TemplateSubCommand
|
public class CreateRepositorySubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("create-user")
|
@Command(name="create-user", group="user")
|
||||||
public class CreateUserSubCommand extends TemplateSubCommand
|
public class CreateUserSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import sonia.scm.cli.config.ScmClientConfig;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-config")
|
@Command(name="delete-config", group="config")
|
||||||
public class DeleteConfigSubCommand extends SubCommand
|
public class DeleteConfigSubCommand extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import sonia.scm.client.ScmClientSession;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-group")
|
@Command(name="delete-group",group="group")
|
||||||
public class DeleteGroupSubCommand extends SubCommand
|
public class DeleteGroupSubCommand extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-members")
|
@Command(name="delete-members",group="group")
|
||||||
public class DeleteMembersSubCommand extends MembersSubCommand
|
public class DeleteMembersSubCommand extends MembersSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-permission")
|
@Command(name="delete-permission",group="repository")
|
||||||
public class DeletePermissionSubCommand extends PermissionSubCommand
|
public class DeletePermissionSubCommand extends PermissionSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import sonia.scm.client.ScmClientSession;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-repository")
|
@Command(name="delete-repository",group="repository")
|
||||||
public class DeleteRepositorySubCommand extends SubCommand
|
public class DeleteRepositorySubCommand extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import sonia.scm.client.ScmClientSession;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("delete-user")
|
@Command(name="delete-user",group="user")
|
||||||
public class DeleteUserSubCommand extends SubCommand
|
public class DeleteUserSubCommand extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("get-group")
|
@Command(name="get-group",group="group")
|
||||||
public class GetGroupSubCommand extends TemplateSubCommand
|
public class GetGroupSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("get-repository")
|
@Command(name="get-repository",group="repository")
|
||||||
public class GetRepositorySubCommand extends TemplateSubCommand
|
public class GetRepositorySubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("get-user")
|
@Command(name="get-user",group="user")
|
||||||
public class GetUserSubCommand extends TemplateSubCommand
|
public class GetUserSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("list-groups")
|
@Command(name="list-groups",group="group")
|
||||||
public class ListGroupsSubCommand extends TemplateSubCommand
|
public class ListGroupsSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("list-repositories")
|
@Command(name="list-repositories",group="repository")
|
||||||
public class ListRepositoriesSubCommand extends TemplateSubCommand
|
public class ListRepositoriesSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("list-users")
|
@Command(name="list-users",group="user")
|
||||||
public class ListUsersSubCommand extends TemplateSubCommand
|
public class ListUsersSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("modify-group")
|
@Command(name="modify-group",group="group")
|
||||||
public class ModifyGroupSubCommand extends TemplateSubCommand
|
public class ModifyGroupSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("modify-repository")
|
@Command(name="modify-repository",group="repository")
|
||||||
public class ModifyRepositorySubCommand extends TemplateSubCommand
|
public class ModifyRepositorySubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import java.util.Map;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("modify-user")
|
@Command(name="modify-user",group="user")
|
||||||
public class ModifyUserSubCommand extends TemplateSubCommand
|
public class ModifyUserSubCommand extends TemplateSubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ import sonia.scm.cli.config.ScmClientConfig;
|
|||||||
*
|
*
|
||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
@Command("store-config")
|
@Command(name = "store-config", group = "config")
|
||||||
public class StoreConfigSubCommand extends SubCommand
|
public class StoreConfigSubCommand extends SubCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
||||||
<logger name="sonia.scm.cli" level="TRACE" />
|
<logger name="sonia.scm.cli" level="ERROR" />
|
||||||
|
|
||||||
<root level="ERROR">
|
<root level="ERROR">
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ VAL = value
|
|||||||
FILE = file
|
FILE = file
|
||||||
error = Error
|
error = Error
|
||||||
|
|
||||||
subCommandsTitle = SubCommands
|
subCommandsTitle = list of commands
|
||||||
|
|
||||||
optionConfig = Configuration name
|
optionConfig = Configuration name
|
||||||
optionServerUrl = SCM-Manager URL
|
optionServerUrl = SCM-Manager URL
|
||||||
@@ -70,3 +70,9 @@ groupNotFoun = The group could not be found
|
|||||||
metaVar_config = configname
|
metaVar_config = configname
|
||||||
metaVar_arg = subcommand arguments
|
metaVar_arg = subcommand arguments
|
||||||
metaVar_command = subcommand
|
metaVar_command = subcommand
|
||||||
|
|
||||||
|
config = Configuration
|
||||||
|
misc = Miscellaneous
|
||||||
|
repository = Repository
|
||||||
|
group = Group
|
||||||
|
user = User
|
||||||
Reference in New Issue
Block a user