(configuration config.Configuration)
| 670 | } |
| 671 | |
| 672 | func openLastModifiedFileIfPresent(configuration config.Configuration) { |
| 673 | if !configuration.IsOpenCommandGiven() { |
| 674 | say.Debug("No open command given") |
| 675 | return |
| 676 | } |
| 677 | |
| 678 | say.Debug("Try to open last modified file") |
| 679 | if !lastCommitIsWipCommit(configuration) { |
| 680 | say.Debug("Last commit isn't a WIP commit.") |
| 681 | return |
| 682 | } |
| 683 | lastCommitMessage := lastCommitMessage() |
| 684 | split := strings.Split(lastCommitMessage, "lastFile:") |
| 685 | if len(split) == 1 { |
| 686 | say.Warning("Couldn't find last modified file in commit message!") |
| 687 | return |
| 688 | } |
| 689 | if len(split) > 2 { |
| 690 | say.Warning("Could not determine last modified file from commit message, separator was used multiple times!") |
| 691 | return |
| 692 | } |
| 693 | lastModifiedFile := strings.Split(split[1], "\n")[0] |
| 694 | if strings.HasPrefix(lastModifiedFile, "\"") { |
| 695 | lastModifiedFile, _ = strconv.Unquote(lastModifiedFile) |
| 696 | } |
| 697 | if lastModifiedFile == "" { |
| 698 | say.Debug("Could not find last modified file in commit message") |
| 699 | return |
| 700 | } |
| 701 | lastModifiedFilePath := gitRootDir() + "/" + lastModifiedFile |
| 702 | commandname, args := openCommandFor(configuration, lastModifiedFilePath) |
| 703 | _, err := startCommand(commandname, args...) |
| 704 | if err != nil { |
| 705 | say.Warning(fmt.Sprintf("Couldn't open last modified file on your system (%s)", runtime.GOOS)) |
| 706 | say.Warning(err.Error()) |
| 707 | return |
| 708 | } |
| 709 | say.Debug("Open last modified file: " + lastModifiedFilePath) |
| 710 | } |
| 711 | |
| 712 | func warnForActiveWipBranches(configuration config.Configuration, currentBaseBranch Branch) { |
| 713 | if isMobProgramming(configuration) { |
no test coverage detected