#+title: Mycmd Concepts And Conventions Concepts and Conventions in MyCmd * Concepts ** Command Group A command group is a unit of hierarchy in MyCmd. It provides common code shared by the commands and command groups that it might contain. ** Commands A command is a script executed by MyCmd. ** MyCmd Registry The MyCmd Registry is the global registry containing the metadata for all discovered command groups and commands. * General Conventions ** Naming Since Bash allows for periods, colons, and dashes in function names, I use them in this fashion: - All top-level MyCmd functionality (in other words, functions from =mycmd/mycmd-lib= and its support libraries) have the =mycmd= prefix. - For functions related to the implementation of "object-like" structures (like command-groups), a colon and the object name follows the =mycmd= prefix, for example, =mycmd:command_group=. - In all cases, a period follows the prefix and is before the function name. - For functions that a purely internal, an underscore precedes the function name. Nothing outside of the file of those functions should call them. ** Specific Naming Conventions - All functions related to the MyCmd Registry have the prefix =mycmd:registry=. - All common functions related to the items in the MyCmd Registry have the prefix =mycmd:registered_item=. - All functions related to a Command Group have the prefix =mycmd:command_group=. - All functions related to a Command have the prefix =mycmd:command=. - When referring to the names of Command Groups or Commands, use the variable name =name=, unless the function refers to both a command group and a command at the same time. In that case, use =command_group_name= and =command_name=. - When referring to a fully qualified name follow the same pattern, but using the name =fully_qualified_name=, with similar exceptions. - When referring to the namespaced parts of Command Groups or Commands, use the variable name =namespaced_parts= for the array version, or the variable name =namespaced_parts_string= for the string version. - When referring to a source directory of a Command Group, use the variable name =source_directory=. - When referring to the source file of a Command Group or Command, use the variable name =source_file_name= for the file name without the full path to the file, and =source_file_path= for the full file path of the source file. - When referring to the child commands of a Command Group, use the variable name =child_commands=. - When referring to the child command groups of a Command Groups, use the variable name =child_command_groups=. - When referring to the short description of a Command Group or a Command, use the variable name =short_description=. - When referring to the long description of a Command Group, use the variable name =long_description=. - When referring to the help text of a Command, use the variable name =help_text=. - When referring to the version of a Command Group or a Command, use the variable name =version=. ** Code Organization