# Module: chiefCommander

Holds all of the functions that manage the command queue, and allows commands to be enqueued and dequeued from the command queue. Also executes the command queue ultimately by making calls to the commandBroker to execute individual commands.

Author:
  - Seth Hollingsead
Copyright:
  - Copyright © 2022-… by Seth Hollingsead. All rights reserved
Source:
  - controllers/chiefCommander.js, line 1

### Requires

- module:commandBroker
- module:chiefData
- module:loggers
- module:data
- module:queue
- @haystacks/constants
- path

### Methods

#### (inner) addClientCommands(clientCommands) → {void}

This is a wrapper function for calling the commandBroker.addClientCommands.

##### Parameters:

Name | Type | Description
--- | --- | ---
`clientCommands` | object | A map of client defined command names and client defined command function calls.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 47

##### Returns:

Type
  void

#### (inner) bootStrapCommands() → {void}

Initializes all of the commands and gets them added to the D-data structure.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 33

##### Returns:

Type
  void

#### (inner) enqueueCommand(command) → {void}

Determines if the command queue has been setup or not, if not then it is initialized, and the command is added to the command queue.

##### Parameters:

Name | Type | Description
--- | --- | ---
`command` | string | The command that should be added to the command queue.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 103

##### Returns:

Type
  void

#### (inner) isCommandQueueEmpty() → {boolean}

Determines if the command queue is empty or not empty.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 124

##### Returns:

A True or False value to indicate if the command queue is empty or not empty.

Type
  boolean

#### (inner) loadCommandAliasesFromPath(commandAliasesFilePathConfigurationName, contextName) → {void}

Loads the command aliases XML file that is specified by the input. The data is automatically saved on the D-data structure.

##### Parameters:

Name | Type | Description
--- | --- | ---
`commandAliasesFilePathConfigurationName` | string | The path and file name to the XML file that contains the command aliases definitions. (Could be system command aliases or client command aliases)
`contextName` | string | The context name defines what parent command alias namespace the loaded and merged data should be stored in. Example: contextName = "framework" => D['CommandsAliases']['Framework'] contextName = "application" => D['CommandAliases']['Application'] contextName = "plugin" => D['CommandAliases']['Plugins']['']

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 62

##### Returns:

Type
  void

#### (inner) processCommandQueue() → {array.<boolean, (string|integer|boolean|object|array)>}

Pulls the command from the front of the command queue and executes it using the command broker.

Author:
  - Seth Hollingsead
Source:
  - controllers/chiefCommander.js, line 141

##### Returns:

An array with a boolean True or False value to indicate if the application should exit or not exit, followed by the command output.

Type
  array.<boolean, (string|integer|boolean|object|array)>