java.lang.Object
net.i2p.util.CommandLine
Direct Known Subclasses:
AddressBookCommandLine, RouterCommandLine, SnarkCommandLine

public class CommandLineextends Object
Simple command line access to various utilities. Not a public API. Subject to change. Apps and plugins should use specific classes.
  • Field Details

    • CLASSES

      protected static final List<String> CLASSES
      List of available command classes.
  • Constructor Details

    • CommandLine

      protected CommandLine()
      Not instantiable; this class only serves the static main(String[]) entry point.
  • Method Details

    • main

      public static void main(String[] args)
      Entry point for command line utilities.
      Parameters:
      args - a subcommand naming a class to run; empty prints the usage
    • exec

      protected static void exec(String[] args, List<String> classes)
      Will only return if command not found.
      Parameters:
      args - a subcommand, optionally followed by its own arguments, which are passed through to the matching class's main
      classes - list of classes to search
    • usage

      private static void usage()
      Prints how to invoke this command-line tool.
    • printCommands

      protected static void printCommands(List<String> classes)
      Print the list of available commands.
      Parameters:
      classes - list of classes to display