<commit_before>proc demo(alpha=1, beta=2.0, verb=false, item="", files: seq[string]): int =
  ## demo entry point with varied, meaningless parameters.
  echo "alpha:", alpha, " beta:", beta, " verb:", verb, " item:", repr(item)
  for i, f in files: echo "args[", i, "]: ", repr(f)
  return 42

proc show(gamma=1, iota=2.0, verb=false, paths: seq[string]): int =
  ## show entry point with varied, meaningless parameters.
  echo "gamma:", gamma, " iota:", iota, " verb:", verb
  for i, p in paths: echo "args[", i, "]: ", repr(p)
  return 42

when isMainModule:
  import cligen, os
  dispatchGen(demo, doc="  This does the demo.", help = {
              "alpha" : "This is a very long parameter help string which " &
                        "ordinarily should be auto-wrapped by alignTable " &
                        "into a multi-line format unless you have eagle " &
                        "eyes, a gigantic monitor, or maybe a little bit of " &
                        "both. :-)",
              "beta" : "This is more modest, but might still wrap around " &
                       "once or twice or so.",
              "verb" : "on=chatty, off=quiet. 'Nuff said." })
  dispatchGen(show, doc="  This shows me something.")
  var pars = commandLineParams()
  var subcmd = pars[0]
  case pars[0]
  of "demo": quit(dispatchdemo(cmdline = pars[1..high(pars)]))
  of "show": quit(dispatchshow(cmdline = pars[1..high(pars)]))
  of "--help":
      echo "Usage:\n  ManualMulti demo|show [subcommand-args]\n"
      echo "    This is a multiple-dispatch cmd.  Subcommand syntax:\n"
      # Don't have multiple Usage: stuff in there.  Also indent subcmd help.
      let use = "ManualMulti $command $args\n$doc\nOptions:\n$options"
      discard dispatchdemo(cmdline = @[ "--help" ], prefix="    ", usage=use)
      discard dispatchshow(cmdline = @[ "--help" ], prefix="    ", usage=use)
      quit(0)
  else: echo "unknown subcommand: ", subcmd
  quit(1)<commit_msg>Use ^1 in slice to not repeat variable name.<commit_after>proc demo(alpha=1, beta=2.0, verb=false, item="", files: seq[string]): int =
  ## demo entry point with varied, meaningless parameters.
  echo "alpha:", alpha, " beta:", beta, " verb:", verb, " item:", repr(item)
  for i, f in files: echo "args[", i, "]: ", repr(f)
  return 42

proc show(gamma=1, iota=2.0, verb=false, paths: seq[string]): int =
  ## show entry point with varied, meaningless parameters.
  echo "gamma:", gamma, " iota:", iota, " verb:", verb
  for i, p in paths: echo "args[", i, "]: ", repr(p)
  return 42

when isMainModule:
  import cligen, os
  dispatchGen(demo, doc="  This does the demo.", help = {
              "alpha" : "This is a very long parameter help string which " &
                        "ordinarily should be auto-wrapped by alignTable " &
                        "into a multi-line format unless you have eagle " &
                        "eyes, a gigantic monitor, or maybe a little bit of " &
                        "both. :-)",
              "beta" : "This is more modest, but might still wrap around " &
                       "once or twice or so.",
              "verb" : "on=chatty, off=quiet. 'Nuff said." })
  dispatchGen(show, doc="  This shows me something.")
  var pars = commandLineParams()
  var subcmd = pars[0]
  case pars[0]
  of "demo": quit(dispatchdemo(cmdline = pars[1..^1]))
  of "show": quit(dispatchshow(cmdline = pars[1..^1]))
  of "--help":
      echo "Usage:\n  ManualMulti demo|show [subcommand-args]\n"
      echo "    This is a multiple-dispatch cmd.  Subcommand syntax:\n"
      # Don't have multiple Usage: stuff in there.  Also indent subcmd help.
      let use = "ManualMulti $command $args\n$doc\nOptions:\n$options"
      discard dispatchdemo(cmdline = @[ "--help" ], prefix="    ", usage=use)
      discard dispatchshow(cmdline = @[ "--help" ], prefix="    ", usage=use)
      quit(0)
  else: echo "unknown subcommand: ", subcmd
  quit(1)
{'fraction_non_alphanumeric': 0.1460188247265327, 'fraction_numerical': 0.008903586873569066, 'mean_word_length': 2.6073394495412843, 'pattern_counts': {'":': 6, '<': 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': '4292890', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1194, 'n_words': 415}