| 307 | } |
| 308 | |
| 309 | func execute(command string, parameter []string, configuration config.Configuration) { |
| 310 | if helpRequested(parameter) { |
| 311 | help.Help(configuration) |
| 312 | return |
| 313 | } |
| 314 | |
| 315 | switch command { |
| 316 | case "s", "start": |
| 317 | err := start(configuration) |
| 318 | if !isMobProgramming(configuration) || err != nil { |
| 319 | Exit(1) |
| 320 | } |
| 321 | if len(parameter) > 0 { |
| 322 | timer := parameter[0] |
| 323 | StartTimer(timer, configuration) |
| 324 | } else if configuration.Timer != "" { |
| 325 | StartTimer(configuration.Timer, configuration) |
| 326 | } else { |
| 327 | say.Info("It's now " + currentTime() + ". Happy collaborating! :)") |
| 328 | } |
| 329 | case "b", "branch": |
| 330 | branch(configuration) |
| 331 | case "n", "next": |
| 332 | next(configuration) |
| 333 | case "d", "done": |
| 334 | done(configuration) |
| 335 | case "fetch": |
| 336 | fetch(configuration) |
| 337 | case "reset": |
| 338 | reset(configuration) |
| 339 | case "clean": |
| 340 | clean(configuration) |
| 341 | case "config": |
| 342 | config.Config(configuration) |
| 343 | case "status": |
| 344 | status(configuration) |
| 345 | case "t", "timer": |
| 346 | if len(parameter) > 0 { |
| 347 | if parameter[0] == "open" || parameter[0] == "o" { |
| 348 | if err := openTimerInBrowser(configuration); err != nil { |
| 349 | say.Error(fmt.Sprintf("Could not open webtimer: %s", err.Error())) |
| 350 | } |
| 351 | } else { |
| 352 | timer := parameter[0] |
| 353 | StartTimer(timer, configuration) |
| 354 | } |
| 355 | } else if configuration.Timer != "" { |
| 356 | StartTimer(configuration.Timer, configuration) |
| 357 | } else { |
| 358 | help.Help(configuration) |
| 359 | } |
| 360 | case "break": |
| 361 | if len(parameter) > 0 { |
| 362 | StartBreakTimer(parameter[0], configuration) |
| 363 | } else { |
| 364 | help.Help(configuration) |
| 365 | } |
| 366 | case "moo": |