[all-commits] [llvm/llvm-project] bbcb7e: [Option] Allow subcommand names as positional argu...

Steven Wu via All-commits all-commits at lists.llvm.org
Mon Sep 28 11:13:26 PDT 2026


  Branch: refs/heads/users/cachemeifyoucan/option-subcommand-names-as-positionals
  Home:   https://github.com/llvm/llvm-project
  Commit: bbcb7e9034480b4793a6edee5ef3239464362e26
      https://github.com/llvm/llvm-project/commit/bbcb7e9034480b4793a6edee5ef3239464362e26
  Author: Steven Wu <stevenwu at apple.com>
  Date:   2026-09-28 (Mon, 28 Sep 2026)

  Changed paths:
    M llvm/include/llvm/Option/ArgList.h
    M llvm/lib/Option/ArgList.cpp
    M llvm/unittests/Option/OptionSubCommandsTest.cpp

  Log Message:
  -----------
  [Option] Allow subcommand names as positional arguments

ArgList::getSubCommand() treats every positional argument that matches
a subcommand name as a subcommand, and reports multiple subcommands if
more than one does. That rejects valid command lines where a later
positional argument happens to be spelled like a subcommand, e.g.

  git branch clone  # create a new branch named "clone"

Add an AllowSubCommandNamesAsPositionals parameter to getSubCommand().
When set, the first positional argument that matches a subcommand name
is the subcommand, and later ones are passed to HandleOtherPositionals
instead of being reported as multiple subcommands.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list