title: CLI with Picocli: Call main command before sub command get called
body: <p>I switched from Apache Commons CLI to Picocli because of the sub command support (and annotation-based declaration).</p>
  
  <p>Consider a command line tool like <code>git</code>, with sub commands like <code>push</code>. Git have a main switch <code>--verbose</code> or <code>-v</code> for enable verbose mode in <strong>all</strong> sub commands.
  How can I implement a main switch that is executed <strong>before</strong> any sub commands?</p>
  
  <p>This is my test</p>
  
  <pre><code>@CommandLine.Command(name = "push",
          description = "Update remote refs along with associated objects")
  class PushCommand implements Callable&lt;Void&gt; {
      @Override
      public Void call() throws Exception {
          System.out.println("#PushCommand.call");
  
          return null;
      }
  }
  
  @CommandLine.Command(description = "Version control", subcommands = {PushCommand.class})
  public class GitApp implements Callable&lt;Void&gt; {
      @CommandLine.Option(names = {"-h", "--help"}, usageHelp = true, description = "Display this help message.")
      private boolean usageHelpRequested;
  
      @CommandLine.Option(names = {"-v", "--verbose"}, description = "Verbose mode. Helpful for troubleshooting.")
      private boolean verboseMode;
  
      public static void main(String[] args) {
          GitApp app = new GitApp();
          CommandLine.call(app, "--verbose", "push");
          System.out.println("#GitApp.main after. verbose: " + (app.verboseMode));
      }
  
      @Override
      public Void call() throws Exception {
          System.out.println("#GitApp.call");
  
          return null;
      }
  }
  </code></pre>
  
  <p>Output is</p>
  
  <pre><code>#PushCommand.call
  #GitApp.main after. verbose: true
  </code></pre>
  
  <p>I would expect, that <code>GitApp.call</code> get called before the sub command get called. But only the sub command get called.</p>