<commit_before>package main

import (
  "fmt"
  getopt "github.com/kesselborn/go-getopt"
  "os"
)

func main() {
  sco := getopt.SubCommandOptions{
    getopt.Options{
      "global description",
      getopt.Definitions{
        {"foo|f", "some arg", getopt.Optional, ""},
        {"command", "command to execute", getopt.IsSubcommand, ""},
      },
    },
    getopt.SubCommands{
      "getenv": {
        "getenv description",
        getopt.Definitions{
          {"bar|b", "some arg", getopt.Optional, ""},
          {"name", "app's name", getopt.IsArg | getopt.Required, ""},
          {"key", "environment variable's name", getopt.IsArg | getopt.Required, ""},
        },
      },
      "register": {
        "register description",
        getopt.Definitions{
          {"deploytype|t", "deploy type (one of mount, bazapta, lxc)", getopt.NoLongOpt | getopt.Optional | getopt.ExampleIsDefault, "lxc"},
          {"name|n", "app's name", getopt.IsArg | getopt.Required, ""},
        },
      },
    },
  }

  scope, options, arguments, passThrough, e := sco.ParseCommandLine()

  if e != nil {
    exit_code := 0

    switch {
    case e.ErrorCode == getopt.WantsUsage:
      fmt.Print(sco.Usage(scope))
    case e.ErrorCode == getopt.WantsHelp:
      fmt.Print(sco.Help(scope))
    default:
      fmt.Println(sco.Help(scope), "\n", "**** Error: ", e.Message, "\n")
      exit_code = e.ErrorCode
    }
    os.Exit(exit_code)
  }

  fmt.Printf("scope:\n%s", scope)
  fmt.Printf("options:\n%#v", options)
  fmt.Printf("arguments: %#v\n", arguments)
  fmt.Printf("passThrough: %#v\n", passThrough)
}<commit_msg>adjust example program to current code<commit_after>package main

import (
  "fmt"
  getopt "github.com/kesselborn/go-getopt"
  "os"
)

func main() {
  sco := getopt.SubCommandOptions{
    getopt.Options{
      "global description",
      getopt.Definitions{
        {"foo|f", "some arg", getopt.Optional, ""},
        {"command", "command to execute", getopt.IsSubCommand, ""},
      },
    },
    getopt.SubCommands{
      "getenv": {
        "getenv description",
        getopt.Definitions{
          {"bar|b", "some arg", getopt.Optional, ""},
          {"name", "app's name", getopt.IsArg | getopt.Required, ""},
          {"key", "environment variable's name", getopt.IsArg | getopt.Required, ""},
        },
      },
      "register": {
        "register description",
        getopt.Definitions{
          {"deploytype|t", "deploy type (one of mount, bazapta, lxc)", getopt.NoLongOpt | getopt.Optional | getopt.ExampleIsDefault, "lxc"},
          {"name|n", "app's name", getopt.IsArg | getopt.Required, ""},
        },
      },
    },
  }

  scope, options, arguments, passThrough, e := sco.ParseCommandLine()

  if e != nil {
    exit_code := 0

    switch {
    case e.ErrorCode == getopt.WantsUsage:
      fmt.Print(sco.Usage())
    case e.ErrorCode == getopt.WantsHelp:
      fmt.Print(sco.Help())
    default:
      fmt.Println(sco.Help(), "\n", "**** Error: ", e.Message, "\n")
      exit_code = e.ErrorCode
    }
    os.Exit(exit_code)
  }

  fmt.Printf("scope:\n%s", scope)
  fmt.Printf("options:\n%#v", options)
  fmt.Printf("arguments: %#v\n", arguments)
  fmt.Printf("passThrough: %#v\n", passThrough)
}
{'fraction_non_alphanumeric': 0.17603458925262508, 'fraction_numerical': 0.0006176652254478073, 'mean_word_length': 2.6475225225225225, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7532068', 'n_tokens_mistral': 1120, 'n_tokens_neox': 1098, 'n_words': 213}