MCPcopy Create free account
hub / github.com/remotemobprogramming/mob / parseUserConfiguration

Function parseUserConfiguration

configuration/configuration.go:221–310  ·  view source on GitHub ↗
(configuration Configuration, path string)

Source from the content-addressed store, hash-verified

219}
220
221func parseUserConfiguration(configuration Configuration, path string) Configuration {
222 file, err := os.Open(path)
223
224 if err != nil {
225 say.Debug("No user configuration file found. (" + path + ") Error: " + err.Error())
226 return configuration
227 } else {
228 say.Debug("Found user configuration file at " + path)
229 }
230
231 fileScanner := bufio.NewScanner(file)
232
233 for fileScanner.Scan() {
234 line := strings.TrimSpace(fileScanner.Text())
235 say.Debug(line)
236 if !strings.Contains(line, "=") {
237 say.Debug("Skip line because line contains no =. Line=" + line)
238 continue
239 }
240 key := line[0:strings.Index(line, "=")]
241 value := strings.TrimPrefix(line, key+"=")
242 say.Debug("Key is " + key)
243 say.Debug("Value is " + value)
244 switch key {
245 case "MOB_CLI_NAME":
246 setUnquotedString(&configuration.CliName, key, value)
247 case "MOB_REMOTE_NAME":
248 setUnquotedString(&configuration.RemoteName, key, value)
249 case "MOB_WIP_COMMIT_MESSAGE":
250 setUnquotedString(&configuration.WipCommitMessage, key, value)
251 case "MOB_START_COMMIT_MESSAGE":
252 setUnquotedString(&configuration.StartCommitMessage, key, value)
253 case "MOB_SKIP_CI_PUSH_OPTION_ENABLED":
254 setBoolean(&configuration.SkipCiPushOptionEnabled, key, value)
255 case "MOB_GIT_HOOKS_ENABLED":
256 setBoolean(&configuration.GitHooksEnabled, key, value)
257 case "MOB_REQUIRE_COMMIT_MESSAGE":
258 setBoolean(&configuration.RequireCommitMessage, key, value)
259 case "MOB_VOICE_COMMAND":
260 setUnquotedString(&configuration.VoiceCommand, key, value)
261 case "MOB_VOICE_MESSAGE":
262 setUnquotedString(&configuration.VoiceMessage, key, value)
263 case "MOB_NOTIFY_COMMAND":
264 setUnquotedString(&configuration.NotifyCommand, key, value)
265 case "MOB_NOTIFY_MESSAGE":
266 setUnquotedString(&configuration.NotifyMessage, key, value)
267 case "MOB_NEXT_STAY":
268 setBoolean(&configuration.NextStay, key, value)
269 case "MOB_START_CREATE":
270 setBoolean(&configuration.StartCreate, key, value)
271 case "MOB_WIP_BRANCH_QUALIFIER":
272 setUnquotedString(&configuration.WipBranchQualifier, key, value)
273 case "MOB_WIP_BRANCH_QUALIFIER_SEPARATOR":
274 setUnquotedString(&configuration.WipBranchQualifierSeparator, key, value)
275 case "MOB_WIP_BRANCH_PREFIX":
276 setUnquotedString(&configuration.WipBranchPrefix, key, value)
277 case "MOB_DONE_SQUASH":
278 setMobDoneSquash(&configuration, key, value)

Calls 5

DebugFunction · 0.92
WarningFunction · 0.92
setUnquotedStringFunction · 0.85
setBooleanFunction · 0.85
setMobDoneSquashFunction · 0.85