@black-flag/core • Docs
@black-flag/core / util / ProgramMetadata
ProgramMetadata:
object
Represents the meta information about a discovered command and its corresponding Configuration object/file.
filename:
string
The basename of filepath
.
filenameWithoutExtension:
string
The basename of filepath
with the trailing extension trimmed.
filepath:
string
Absolute filesystem path to the loaded configuration file.
hasChildren:
boolean
If true
, this command is a "pure parent" or "parent-child" that has at
least one child command.
isImplemented:
boolean
If true
, this command exported neither a command
string nor a handler
function. Black Flag therefore considers this command "unimplemented".
When executed, unimplemented commands will show help text before throwing a context-specific error.
parentDirName:
string
The basename of the direct parent directory containing filepath
.
reservedCommandNames:
string
[]
The names "reserved" by this command. When a name is reserved by a command, no other sibling command (i.e. a command with the same parent command) can use that name as an name or alias. When attempting to add a command that uses the same name as its sibling, an error with be thrown.
All commands attempt to reserve their name
and aliases
exports upon
discovery.
Invariant: name
must be at index 0; ...aliases
must start at index
1.
type:
ProgramType
The "type" of Configuration that was loaded, indicating which
interface to expect when interacting with configuration
. The
possibilities are:
- root: implements
RootConfiguration
(the only pureParentConfiguration
) - parent-child: implements
ParentConfiguration
,ChildConfiguration
- child: implements
ChildConfiguration
Note that "root" type
configurations are unique in that there will only
ever be one RootConfiguration
, and it MUST be the first command
module auto-discovered and loaded (invariant).