| 135 | } |
| 136 | |
| 137 | func getModuleOperationCommand(mod moduleconfig.ModuleConfig, operation string) (operationCommand []string) { |
| 138 | defaultCheck := []string{"make", "check"} |
| 139 | defaultApply := []string{"make"} |
| 140 | defaultSummary := []string{"make", "summary"} |
| 141 | |
| 142 | switch operation { |
| 143 | case "check": |
| 144 | if mod.Commands.Check != "" { |
| 145 | operationCommand = []string{"sh", "-c", mod.Commands.Check} |
| 146 | } else { |
| 147 | operationCommand = defaultCheck |
| 148 | } |
| 149 | case "apply": |
| 150 | if mod.Commands.Apply != "" { |
| 151 | operationCommand = []string{"sh", "-c", mod.Commands.Apply} |
| 152 | } else { |
| 153 | operationCommand = defaultApply |
| 154 | } |
| 155 | case "summary": |
| 156 | if mod.Commands.Summary != "" { |
| 157 | operationCommand = []string{"sh", "-c", mod.Commands.Summary} |
| 158 | } else { |
| 159 | operationCommand = defaultSummary |
| 160 | } |
| 161 | default: |
| 162 | panic("Unexpected operation") |
| 163 | } |
| 164 | return operationCommand |
| 165 | } |
| 166 | |
| 167 | // promptEnvironments Prompts the user for the environments to apply against and returns a slice of strings representing the environments |
| 168 | func promptEnvironments() []string { |