Class Main

java.lang.Object
org.eclipse.jgit.pgm.Main
Direct Known Subclasses:
CLIGitCommand

public class Main extends Object
Command line entry point.
  • Field Details

    • help

      private boolean help
    • version

      private boolean version
    • showStackTrace

      private boolean showStackTrace
    • gitdir

      private String gitdir
    • subcommand

      private TextBuiltin subcommand
    • arguments

      private List<String> arguments
    • writer

      PrintWriter writer
    • gcExecutor

      private ExecutorService gcExecutor
  • Constructor Details

    • Main

      public Main()

      Constructor for Main.

  • Method Details

    • main

      public static void main(String[] argv) throws Exception
      Execute the command line.
      Parameters:
      argv - arguments.
      Throws:
      Exception
    • run

      protected void run(String[] argv) throws Exception
      Parse the command line and execute the requested action. Subclasses should allocate themselves and then invoke this method:
       class ExtMain {
              public static void main(String[] argv) {
                      new ExtMain().run(argv);
              }
       }
       
      Parameters:
      argv - arguments.
      Throws:
      Exception
    • createErrorWriter

      PrintWriter createErrorWriter()
    • execute

      private void execute(String[] argv) throws Exception
      Throws:
      Exception
    • init

      void init(TextBuiltin cmd) throws IOException
      Throws:
      IOException
    • exit

      void exit(int status, Exception t) throws Exception
      Parameters:
      status -
      t - can be null
      Throws:
      Exception
    • openGitDir

      protected Repository openGitDir(String aGitdir) throws IOException
      Evaluate the --git-dir option and open the repository.
      Parameters:
      aGitdir - the --git-dir option given on the command line. May be null if it was not supplied.
      Returns:
      the repository to operate on.
      Throws:
      IOException - the repository cannot be opened.
    • installConsole

      private static boolean installConsole()
    • install

      Throws:
      IllegalAccessException
      InvocationTargetException
      NoSuchMethodException
      ClassNotFoundException
    • configureHttpProxy

      static void configureHttpProxy() throws MalformedURLException
      Configure the JRE's standard HTTP based on http_proxy.

      The popular libcurl library honors the http_proxy, https_proxy environment variables as a means of specifying an HTTP/S proxy for requests made behind a firewall. This is not natively recognized by the JRE, so this method can be used by command line utilities to configure the JRE before the first request is sent. The information found in the environment variables is copied to the associated system properties. This is not done when the system properties are already set. The default way of telling java programs about proxies (the system properties) takes precedence over environment variables.

      Throws:
      MalformedURLException - the value in http_proxy or https_proxy is unsupportable.