View Source DoIt.Introspection (do_it v0.7.0)
Provides introspection capabilities for DoIt commands and their structure.
This module enables analysis of command hierarchies, options, arguments, and other metadata needed for features like auto-completion.
Summary
Functions
Finds a command module by name from a MainCommand module.
Finds a subcommand module by name from a Command module.
Gets all possible command paths as flat list.
Gets all top-level commands from a MainCommand module.
Gets all arguments from a Command module.
Gets all option flags (--name and -alias) from a Command module.
Gets all options from a Command module.
Gets the command structure as a nested map for introspection.
Gets all subcommands from a Command module.
Checks if a command has subcommands.
Resolves a command path to its final command module.
Functions
Finds a command module by name from a MainCommand module.
Returns the module atom or nil if not found.
Finds a subcommand module by name from a Command module.
Returns the module atom or nil if not found.
Gets all possible command paths as flat list.
Returns a list of command paths where each path is a list of strings.
Gets all top-level commands from a MainCommand module.
Returns a list of command names as strings.
Gets all arguments from a Command module.
Returns a list of DoIt.Argument structs.
Gets all option flags (--name and -alias) from a Command module.
Returns a list of option flags as strings.
Gets all options from a Command module.
Returns a list of DoIt.Option structs.
Gets the command structure as a nested map for introspection.
Returns a map containing the full command hierarchy with metadata.
Gets all subcommands from a Command module.
Returns a list of subcommand names as strings.
Checks if a command has subcommands.
Resolves a command path to its final command module.
Takes a main module and a list of command/subcommand names, returns the final command module or nil if path is invalid.
Examples
iex> resolve_command_path(MyApp, ["user", "create"])
MyApp.User.Create
iex> resolve_command_path(MyApp, ["invalid"])
nil