ArgumentParser Export API
The ArgumentParser provides introspection methods to enumerate and inspect all registered argument definitions at runtime.
Methods
getAllArgs
pub fn getAllArgs(self: *const ArgumentParser) []const ArgSpecReturns a read-only slice of every registered ArgSpec. The returned pointers remain valid until the parser is deinitialised or the argument list is mutated.
getAllSubcommands
pub fn getAllSubcommands(self: *const ArgumentParser) []const SubcommandSpecReturns a read-only slice of every registered SubcommandSpec.
getAllGroups
pub fn getAllGroups(self: *const ArgumentParser) []const ArgumentGroupReturns a read-only slice of every registered ArgumentGroup.
getAllMutualExclusions
pub fn getAllMutualExclusions(self: *const ArgumentParser) []const []const []const u8Returns the mutual-exclusion groups (each group is a slice of arg names).
exportSpec
pub fn exportSpec(self: *ArgumentParser) CommandSpecBuilds and returns the full CommandSpec snapshot.
getArgSpec
pub fn getArgSpec(self: *const ArgumentParser, name: []const u8) ?ArgSpecLooks up a single ArgSpec by name, long flag, destination, or alias. Returns null if no match.
totalArgCount
pub fn totalArgCount(self: *const ArgumentParser) usizeReturns the number of registered arguments (including hidden ones).
totalSubcommandCount
pub fn totalSubcommandCount(self: *const ArgumentParser) usizeReturns the number of registered subcommands.
totalGroupCount
pub fn totalGroupCount(self: *const ArgumentParser) usizeReturns the number of registered argument groups.
Related Methods
buildSpec
pub fn buildSpec(self: *ArgumentParser) CommandSpecBuilds the internal CommandSpec snapshot. exportSpec is a convenience alias for this.
