src/org/sonews/daemon/command/HelpCommand.java
changeset 120 bb1c8a7b774c
parent 35 ed84c8bdd87b
     1.1 --- a/src/org/sonews/daemon/command/HelpCommand.java	Sun Aug 29 17:28:58 2010 +0200
     1.2 +++ b/src/org/sonews/daemon/command/HelpCommand.java	Wed Dec 31 12:07:40 2014 +0100
     1.3 @@ -35,66 +35,56 @@
     1.4  public class HelpCommand implements Command
     1.5  {
     1.6  
     1.7 -  @Override
     1.8 -  public boolean hasFinished()
     1.9 -  {
    1.10 -    return true;
    1.11 -  }
    1.12 +	@Override
    1.13 +	public boolean hasFinished()
    1.14 +	{
    1.15 +		return true;
    1.16 +	}
    1.17  
    1.18 -  @Override
    1.19 -  public String impliedCapability()
    1.20 -  {
    1.21 -    return null;
    1.22 -  }
    1.23 +	@Override
    1.24 +	public String impliedCapability()
    1.25 +	{
    1.26 +		return null;
    1.27 +	}
    1.28  
    1.29 -  @Override
    1.30 -  public boolean isStateful()
    1.31 -  {
    1.32 -    return true;
    1.33 -  }
    1.34 +	@Override
    1.35 +	public boolean isStateful()
    1.36 +	{
    1.37 +		return true;
    1.38 +	}
    1.39  
    1.40 -  @Override
    1.41 -  public String[] getSupportedCommandStrings()
    1.42 -  {
    1.43 -    return new String[]{"HELP"};
    1.44 -  }
    1.45 -  
    1.46 -  @Override
    1.47 -  public void processLine(NNTPConnection conn, final String line, byte[] raw)
    1.48 -    throws IOException
    1.49 -  {
    1.50 -    final String[] command = line.split(" ");
    1.51 -    conn.println("100 help text follows");
    1.52 +	@Override
    1.53 +	public String[] getSupportedCommandStrings()
    1.54 +	{
    1.55 +		return new String[] {"HELP"};
    1.56 +	}
    1.57  
    1.58 -    if(line.length() <= 1)
    1.59 -    {
    1.60 -      final String[] help = Resource
    1.61 -        .getAsString("helpers/helptext", true).split("\n");
    1.62 -      for(String hstr : help)
    1.63 -      {
    1.64 -        conn.println(hstr);
    1.65 -      }
    1.66 +	@Override
    1.67 +	public void processLine(NNTPConnection conn, final String line, byte[] raw)
    1.68 +		throws IOException
    1.69 +	{
    1.70 +		final String[] command = line.split(" ");
    1.71 +		conn.println("100 help text follows");
    1.72  
    1.73 -      Set<String> commandNames = CommandSelector.getCommandNames();
    1.74 -      for(String cmdName : commandNames)
    1.75 -      {
    1.76 -        conn.println(cmdName);
    1.77 -      }
    1.78 -    }
    1.79 -    else
    1.80 -    {
    1.81 -      Command cmd = CommandSelector.getInstance().get(command[1]);
    1.82 -      if(cmd instanceof HelpfulCommand)
    1.83 -      {
    1.84 -        conn.println(((HelpfulCommand)cmd).getHelpString());
    1.85 -      }
    1.86 -      else
    1.87 -      {
    1.88 -        conn.println("No further help information available.");
    1.89 -      }
    1.90 -    }
    1.91 -    
    1.92 -    conn.println(".");
    1.93 -  }
    1.94 -  
    1.95 +		if (line.length() <= 1) {
    1.96 +			final String[] help = Resource.getAsString("helpers/helptext", true).split("\n");
    1.97 +			for (String hstr : help) {
    1.98 +				conn.println(hstr);
    1.99 +			}
   1.100 +
   1.101 +			Set<String> commandNames = CommandSelector.getCommandNames();
   1.102 +			for (String cmdName : commandNames) {
   1.103 +				conn.println(cmdName);
   1.104 +			}
   1.105 +		} else {
   1.106 +			Command cmd = CommandSelector.getInstance().get(command[1]);
   1.107 +			if (cmd instanceof HelpfulCommand) {
   1.108 +				conn.println(((HelpfulCommand) cmd).getHelpString());
   1.109 +			} else {
   1.110 +				conn.println("No further help information available.");
   1.111 +			}
   1.112 +		}
   1.113 +
   1.114 +		conn.println(".");
   1.115 +	}
   1.116  }