diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5990d9c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/build_test_release.yml b/.github/workflows/build_test_release.yml index 74ddd91..ee035c2 100644 --- a/.github/workflows/build_test_release.yml +++ b/.github/workflows/build_test_release.yml @@ -12,9 +12,29 @@ jobs: - name: Setup Go uses: actions/setup-go@v3 - uses: actions/checkout@v3 - - run: go get dagger.io/dagger@latest - - run: mkdir dist + - name: Setup Go Workfile + run: go work init ./ci ./src_code/go_src + - run: cd ci && go get dagger.io/dagger@latest && cd .. + - run: mkdir ./dist - run: go run ci/build_test_release.go + - name: Auto Changelog + uses: ardalanamini/auto-changelog@v4.0.1 + id : changelog + with: + github-token : ${{ secrets.GITHUB_TOKEN }} + commit-types : | + feat: New Features + fix: Bug Fixes + build: Build System & Dependencies + perf: Performance Improvements + docs: Documentation + test: Tests + refactor: Refactors + chore: Chores + ci: CI + cd: CD + style: Code Style + revert: Reverts - name: publish project shell: bash run: | @@ -24,18 +44,19 @@ jobs: #linux build release_name_linux="cocommit_go-$tag-linux" - tar -C ./dist -czvf "${release_name_linux}.tar.gz" ./cocommit_go-linux ./author.txt + tar -C ./dist -czvf "${release_name_linux}.tar.gz" cocommit_go-linux ./author.txt #windows build release_name_win="cocommit_go-$tag-win" - tar -C ./dist -czvf "${release_name_win}.tar.gz" ./dist/cocommit_go-windows ./author.txt + tar -C ./dist -czvf "${release_name_win}.tar.gz" cocommit_go-windows ./author.txt #mac build release_name_mac="cocommit_go-$tag-mac" - tar -C ./dist -czvf "${release_name_mac}.tar.gz" ./cocommit_go-darwin ./author.txt + tar -C ./dist -czvf "${release_name_mac}.tar.gz" cocommit_go-darwin ./author.txt - name: Release project uses: softprops/action-gh-release@v1 with: + body: ${{steps.changelog.outputs.changelog}} files: "*.tar.gz" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/test_push.yml b/.github/workflows/test_push.yml new file mode 100644 index 0000000..9a039a3 --- /dev/null +++ b/.github/workflows/test_push.yml @@ -0,0 +1,23 @@ +name: Test On Push + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: actions/setup-go@v3 + - uses: actions/checkout@v3 + - name: Setup Go Workfile + run: go work init ./ci ./src_code/go_src + - name: Get Dagger + run: cd ci && go get dagger.io/dagger@latest && cd .. + - name: Run Dagger Test Workflow + run: go run ci/test_on_push.go \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8e0c0e5..28f8353 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ # Custom -dist \ No newline at end of file +dist + +go.work +go.sum +go.work.sum +go.work \ No newline at end of file diff --git a/README.md b/README.md index 973b672..61f7968 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,51 @@ # cocommit + +## IMPORTANT NOTICE!!!! +### Windows defender recently got an update that apparently sees Go Binaries as a trojan... So I guess you have to manually go in and flag it as not being that until Microsoft decides to fix this. +[Link to Github issue talking about this](https://github.com/golang/vscode-go/issues/3182) Currently built in: - [x] Go -- [ ] C++ -- [ ] Python +- [ ] Rust + Currently tested in: - [x] Go -- [ ] C++ -- [ ] Python +- [ ] Rust + # How to run Download the binary for your OS on the [release page](https://github.com/Slug-Boi/cocommit/releases) Once downloaded you need to create an alias for your shell guides found below: -[Bash Guide](https://linuxize.com/post/how-to-create-bash-aliases/) +[Bash Guide for alias](https://linuxize.com/post/how-to-create-bash-aliases/) *^please note if you use another shell than bash you will need to look up how to do it in that shell^* -[Powershell Guide](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-alias?view=powershell-7.4) +[Powershell Guide for alias](https://stackoverflow.com/questions/24914589/how-to-create-permanent-powershell-aliases) -Once you've created an alias for the program you need to set an env variable (authors_file) in your shell. This should be the path pointing to your author.txt file +Once you've created an alias for the program you need to set an env variable (author_file) in your shell. This should be the path pointing to your author.txt file +For bash you just need to add this to your .bashrc file: +``` +export author_file='path/to/your/aurhor.txt' +``` +[Powershell guide for env variable](https://stackoverflow.com/a/714918) + +*Please note that the syntax line at the top of the author.txt file should not be deleted and that you must add at least one author to the file to run the program* you can now run it using the alias shorthand you assigned to it ## Usage: -```zsh +``` $ cocommit "message" [name2] [name3]... $ cocommit "message" [name:email2] [name:email3]... -$ cocommit "message" [name:email2] +$ cocommit "message" [name:email2] + +$ cocommit "message" all +*adds all comitters execpt ones tagged with ex* + +$ cocommit "message" ^ ^[name2] +*adds all users except the negated users and users tagged with ex* + +$ cocommit "message" +*adds all users that has that group tag in author file* $ cocommit *prints usage* @@ -35,15 +55,18 @@ $ cocommit users ``` # Syntax for the author file -The syntax for the author file can be found at the top of the template file included in the repo. It should look like this: +The syntax for the author file can be found at the top of the template file included in the repo. It should look like this (opt) is optional syntax: ``` -name_short|Name|Username|email +name_short|Name|Username|email (opt: |ex) (opt: ;;group1 or ;;group1|group2|group3...) ``` +opt explained: +ex -> excludes the given author for all and negation commands +group -> groups an author which can then be called as an argument to add all people from that group. An author can be a part of multiple groups # Why? Writing co-authors onto commits can be pretty tedious so automating this process as a simple shell alias is a lot nicer # Workflows This repo is sort of a test bed for working with Dagger CI but therefore also should support automated testing and building at some point -*coming soon* +*See ci folder for the current dagger workflows* diff --git a/ci/build_test_release.go b/ci/build_test_release.go index eede784..aabc2d3 100644 --- a/ci/build_test_release.go +++ b/ci/build_test_release.go @@ -18,29 +18,29 @@ func main() { } defer client.Close() + goCache := client.CacheVolume("golang") + // use a node:16-slim container // mount the source code directory on the host // at /src in the container source := client.Container(). - From("golang:1.21"). + From("golang:1.22"). WithDirectory("/src", client.Host().Directory(".", dagger.HostDirectoryOpts{ - Exclude: []string{"ci/"}, - })) + Exclude: []string{}, + })).WithMountedCache("/src/dagger_dep_cache/go_dep", goCache) geese := []string{"darwin", "linux", "windows"} goarch := "amd64" // set the working directory in the container // install application dependencies - runner := source.WithWorkdir("/src"). + runner := source.WithWorkdir("/src/src_code/go_src/"). WithExec([]string{"go", "mod", "tidy"}) - runner = source.WithWorkdir("/src/src_code/go_src") // run application tests - - test := runner.WithExec([]string{"go", "test"}) + test := runner.WithWorkdir("/src/src_code/go_src").WithExec([]string{"go", "test"}) - buildDir := test.Directory("/src/dist") + buildDir := test.Directory("/src/") for _, goos := range geese { path := fmt.Sprintf("/dist/") diff --git a/ci/go.mod b/ci/go.mod new file mode 100644 index 0000000..ebb1fea --- /dev/null +++ b/ci/go.mod @@ -0,0 +1,23 @@ +module ci + +go 1.21.9 + +require dagger.io/dagger v0.11.4 + +require ( + github.com/99designs/gqlgen v0.17.44 // indirect + github.com/Khan/genqlient v0.7.0 // indirect + github.com/adrg/xdg v0.4.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/sosodev/duration v1.2.0 // indirect + github.com/vektah/gqlparser/v2 v2.5.15 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.17.0 // indirect +) diff --git a/ci/test_on_push.go b/ci/test_on_push.go new file mode 100644 index 0000000..efc04ca --- /dev/null +++ b/ci/test_on_push.go @@ -0,0 +1,44 @@ +package main + +import ( + "context" + "fmt" + "os" + + "dagger.io/dagger" +) + +func main() { + ctx := context.Background() + + // initialize Dagger client + client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stderr)) + if err != nil { + panic(err) + } + defer client.Close() + + goCache := client.CacheVolume("golang") + + // use a node:16-slim container + // mount the source code directory on the host + // at /src in the container + source := client.Container(). + From("golang:1.22"). + WithDirectory("/src", client.Host().Directory(".", dagger.HostDirectoryOpts{ + Exclude: []string{"build/"}, + })).WithMountedCache("/src/dagger_dep_cache/go_dep", goCache) + + // set the working directory in the container + // install application dependencies + runner := source.WithWorkdir("/src/src_code/go_src/"). + WithExec([]string{"go", "mod", "tidy"}) + + // run application tests + out, err := runner.WithWorkdir("/src/src_code/go_src").WithExec([]string{"go", "test"}). + Stderr(ctx) + if err != nil { + panic(err) + } + fmt.Println(out) +} \ No newline at end of file diff --git a/dagger_dep_cache/go_dep/ReadMe.md b/dagger_dep_cache/go_dep/ReadMe.md new file mode 100644 index 0000000..1320c12 --- /dev/null +++ b/dagger_dep_cache/go_dep/ReadMe.md @@ -0,0 +1,3 @@ +# This folder is the cache for the Dagger CI workflows on the GO version of cocommit + +Currently it will be empty but might start having dependencies later down the line \ No newline at end of file diff --git a/go.mod b/go.mod deleted file mode 100644 index a00417e..0000000 --- a/go.mod +++ /dev/null @@ -1,55 +0,0 @@ -module main - -go 1.21.0 - -require ( - dagger.io/dagger v0.10.0 - github.com/charmbracelet/bubbles v0.20.0 - github.com/charmbracelet/bubbletea v1.1.1 - github.com/charmbracelet/glamour v0.8.0 - github.com/charmbracelet/lipgloss v0.13.0 - github.com/charmbracelet/x/exp/teatest v0.0.0-20241022174419-46d9bb99a691 - github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3 - github.com/spf13/cobra v1.8.1 -) - -require ( - github.com/99designs/gqlgen v0.17.31 // indirect - github.com/Khan/genqlient v0.6.0 // indirect - github.com/adrg/xdg v0.4.0 // indirect - github.com/alecthomas/chroma/v2 v2.14.0 // indirect - github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect - github.com/aymanbagabas/go-udiff v0.2.0 // indirect - github.com/aymerick/douceur v0.2.0 // indirect - github.com/charmbracelet/x/ansi v0.2.3 // indirect - github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b // indirect - github.com/charmbracelet/x/term v0.2.0 // indirect - github.com/dlclark/regexp2 v1.11.0 // indirect - github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect - github.com/gorilla/css v1.0.1 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/microcosm-cc/bluemonday v1.0.27 // indirect - github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect - github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a // indirect - github.com/rivo/uniseg v0.4.7 // indirect - github.com/sahilm/fuzzy v0.1.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/vektah/gqlparser/v2 v2.5.6 // indirect - github.com/yuin/goldmark v1.7.4 // indirect - github.com/yuin/goldmark-emoji v1.0.3 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.19.0 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 2f5145e..0000000 --- a/go.sum +++ /dev/null @@ -1,138 +0,0 @@ -dagger.io/dagger v0.10.0 h1:iRzQLVOe89rZQwfpcKq8kZLBLXU50uiDti7txZjcl6A= -dagger.io/dagger v0.10.0/go.mod h1:aq9P87v4apEOXKPXzn35uK+by5dUplSU5ZeXm+E8Sgw= -github.com/99designs/gqlgen v0.17.31 h1:VncSQ82VxieHkea8tz11p7h/zSbvHSxSDZfywqWt158= -github.com/99designs/gqlgen v0.17.31/go.mod h1:i4rEatMrzzu6RXaHydq1nmEPZkb3bKQsnxNRHS4DQB4= -github.com/Khan/genqlient v0.6.0 h1:Bwb1170ekuNIVIwTJEqvO8y7RxBxXu639VJOkKSrwAk= -github.com/Khan/genqlient v0.6.0/go.mod h1:rvChwWVTqXhiapdhLDV4bp9tz/Xvtewwkon4DpWWCRM= -github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= -github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= -github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls= -github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E= -github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= -github.com/alecthomas/assert/v2 v2.7.0 h1:QtqSACNS3tF7oasA8CU6A6sXZSBDqnm7RfpLl9bZqbE= -github.com/alecthomas/assert/v2 v2.7.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k= -github.com/alecthomas/chroma/v2 v2.14.0 h1:R3+wzpnUArGcQz7fCETQBzO5n9IMNi13iIs46aU4V9E= -github.com/alecthomas/chroma/v2 v2.14.0/go.mod h1:QolEbTfmUHIMVpBqxeDnNBj2uoeI4EbYP4i6n68SG4I= -github.com/alecthomas/repr v0.4.0 h1:GhI2A8MACjfegCPVq9f1FLvIBS+DrQ2KQBFZP1iFzXc= -github.com/alecthomas/repr v0.4.0/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= -github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= -github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= -github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= -github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8= -github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA= -github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= -github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/charmbracelet/bubbles v0.20.0 h1:jSZu6qD8cRQ6k9OMfR1WlM+ruM8fkPWkHvQWD9LIutE= -github.com/charmbracelet/bubbles v0.20.0/go.mod h1:39slydyswPy+uVOHZ5x/GjwVAFkCsV8IIVy+4MhzwwU= -github.com/charmbracelet/bubbletea v1.1.1 h1:KJ2/DnmpfqFtDNVTvYZ6zpPFL9iRCRr0qqKOCvppbPY= -github.com/charmbracelet/bubbletea v1.1.1/go.mod h1:9Ogk0HrdbHolIKHdjfFpyXJmiCzGwy+FesYkZr7hYU4= -github.com/charmbracelet/glamour v0.8.0 h1:tPrjL3aRcQbn++7t18wOpgLyl8wrOHUEDS7IZ68QtZs= -github.com/charmbracelet/glamour v0.8.0/go.mod h1:ViRgmKkf3u5S7uakt2czJ272WSg2ZenlYEZXT2x7Bjw= -github.com/charmbracelet/lipgloss v0.13.0 h1:4X3PPeoWEDCMvzDvGmTajSyYPcZM4+y8sCA/SsA3cjw= -github.com/charmbracelet/lipgloss v0.13.0/go.mod h1:nw4zy0SBX/F/eAO1cWdcvy6qnkDUxr8Lw7dvFrAIbbY= -github.com/charmbracelet/x/ansi v0.2.3 h1:VfFN0NUpcjBRd4DnKfRaIRo53KRgey/nhOoEqosGDEY= -github.com/charmbracelet/x/ansi v0.2.3/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= -github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b h1:MnAMdlwSltxJyULnrYbkZpp4k58Co7Tah3ciKhSNo0Q= -github.com/charmbracelet/x/exp/golden v0.0.0-20240815200342-61de596daa2b/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= -github.com/charmbracelet/x/exp/teatest v0.0.0-20241022174419-46d9bb99a691 h1:xiYMZ3dUF3iXc90LCTKj5ZiiwuCvhEvGsF/qUCMRgEk= -github.com/charmbracelet/x/exp/teatest v0.0.0-20241022174419-46d9bb99a691/go.mod h1:ektxP4TiEONm1mTGILRfo8F0a4rZMwsT1fEkXslQKtU= -github.com/charmbracelet/x/term v0.2.0 h1:cNB9Ot9q8I711MyZ7myUR5HFWL/lc3OpU8jZ4hwm0x0= -github.com/charmbracelet/x/term v0.2.0/go.mod h1:GVxgxAbjUrmpvIINHIQnJJKpMlHiZ4cktEQCN6GWyF0= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= -github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI= -github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= -github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= -github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= -github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= -github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= -github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg= -github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3 h1:fO9A67/izFYFYky7l1pDP5Dr0BTCRkaQJUG6Jm5ehsk= -github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3/go.mod h1:Ey4uAp+LvIl+s5jRbOHLcZpUDnkjLBROl15fZLwPlTM= -github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= -github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= -github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= -github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI= -github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= -github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= -github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a h1:2MaM6YC3mGu54x+RKAA6JiFFHlHDY1UbkxqppT7wYOg= -github.com/muesli/termenv v0.15.3-0.20240618155329-98d742f6907a/go.mod h1:hxSnBBYLK21Vtq/PHd0S2FYCxBXzBua8ov5s1RobyRQ= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= -github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sahilm/fuzzy v0.1.1 h1:ceu5RHF8DGgoi+/dR5PsECjCDH1BE3Fnmpo7aVXOdRA= -github.com/sahilm/fuzzy v0.1.1/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8= -github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/vektah/gqlparser/v2 v2.5.6 h1:Ou14T0N1s191eRMZ1gARVqohcbe1e8FrcONScsq8cRU= -github.com/vektah/gqlparser/v2 v2.5.6/go.mod h1:z8xXUff237NntSuH8mLFijZ+1tjV1swDbpDqjJmk6ME= -github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= -github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -github.com/yuin/goldmark-emoji v1.0.3 h1:aLRkLHOuBR2czCY4R8olwMjID+tENfhyFDMCRhbIQY4= -github.com/yuin/goldmark-emoji v1.0.3/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= -golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/go.work b/go.work deleted file mode 100644 index 7c46f61..0000000 --- a/go.work +++ /dev/null @@ -1,3 +0,0 @@ -go 1.21.0 - -use ./ \ No newline at end of file diff --git a/go.work.sum b/go.work.sum deleted file mode 100644 index bbfc53f..0000000 --- a/go.work.sum +++ /dev/null @@ -1,54 +0,0 @@ -github.com/alexflint/go-arg v1.4.2/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf2y2768kM= -github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw= -github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= -github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -github.com/alexflint/go-arg v1.4.2/go.mod h1:9iRbDxne7LcR/GSvEr7ma++GLpdIU1zrghf2y2768kM= -github.com/alexflint/go-scalar v1.0.0/go.mod h1:GpHzbCOZXEKMEcygYQ5n/aa4Aq84zbxjy3MxYW0gjYw= -github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= -github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/golang-lru/v2 v2.0.1/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= -github.com/kevinmbeaulieu/eq-go v1.0.0/go.mod h1:G3S8ajA56gKBZm4UB9AOyoOS37JO3roToPzKNM8dtdM= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/logrusorgru/aurora/v3 v3.0.0/go.mod h1:vsR12bk5grlLvLXAYrBsb5Oc/N+LxAlxggSjiwMnCUc= -github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= -github.com/urfave/cli/v2 v2.24.4/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= -github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= -golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/makefile b/makefile new file mode 100644 index 0000000..ac223bc --- /dev/null +++ b/makefile @@ -0,0 +1,5 @@ +build: + go build -C src_code/go_src/ -o cocommit + +build-nix: + GOWORK=off go build -C src_code/go_src/ -o cocommit \ No newline at end of file diff --git a/src_code/go_src/author.txt b/src_code/go_src/author.txt index 8cd7b5b..76b9873 100644 --- a/src_code/go_src/author.txt +++ b/src_code/go_src/author.txt @@ -1 +1 @@ -Syntax: name_short|Name|Username|email !!Remember to set the env var authors_file!! \ No newline at end of file +Syntax: name_short|Name|Username|email (opt: |ex) (opt: ;;group1|group2|group3...) !!Remember to set the env var authors_file!! diff --git a/src_code/go_src/author_file b/src_code/go_src/author_file new file mode 100644 index 0000000..7a65fb8 --- /dev/null +++ b/src_code/go_src/author_file @@ -0,0 +1,4 @@ +Syntax for authorfile +test|test|test|test|ex;;test +tet|tessadsat|teta|asdadad|ex;;adsadas +teadsajdma|asdasdasda|adsdadasd|addsadasd;;adsadsadadas \ No newline at end of file diff --git a/src_code/go_src/cmd/tui/tui_test.go b/src_code/go_src/cmd/tui/tui_test.go new file mode 100644 index 0000000..89c0c2a --- /dev/null +++ b/src_code/go_src/cmd/tui/tui_test.go @@ -0,0 +1,55 @@ +package tui + +import ( + "bytes" + "os" + "testing" + "time" + + tea "github.com/charmbracelet/bubbletea" + "github.com/charmbracelet/x/exp/teatest" +) + +const author_data = `syntax for the test file +te|testing|TestUser|test@test.test|ex +ti|testtest|UserName2|testing@user.io;;gr1` + +var envVar string + +func setup() { + // setup test data + err := os.WriteFile("author_file_test", []byte(author_data), 0644) + if err != nil { + panic(err) + } + os.Setenv("author_file", "author_file_test") + envVar = os.Getenv("author_file") +} + +func teardown() { + // remove test data + os.Remove("author_file_test") + os.Setenv("author_file", envVar) +} + +func TestShowUser(t *testing.T) { + setup() + defer teardown() + + m := intialModel_US(envVar) + tm := teatest.NewTestModel( + t, m, + teatest.WithInitialTermSize(300, 300), + ) + teatest.WaitFor(t, tm.Output(), func(bts []byte) bool { + return bytes.Contains(bts, []byte("syntax for the test file")) + }, teatest.WithCheckInterval(time.Millisecond*100), teatest.WithDuration(time.Second*2)) + + tm.Send(tea.KeyMsg{ + Type: tea.KeyRunes, + Runes: []rune("q"), + }) + + tm.WaitFinished(t, teatest.WithFinalTimeout(time.Second)) + +} diff --git a/src_code/go_src/deprecated/cocommit_test.go b/src_code/go_src/deprecated/cocommit_test.go index cf08549..5c62140 100644 --- a/src_code/go_src/deprecated/cocommit_test.go +++ b/src_code/go_src/deprecated/cocommit_test.go @@ -65,7 +65,7 @@ func Test_add_all(t *testing.T) { if !strings.Contains(commit, "\nCo-authored-by: test1 ") || !strings.Contains(commit, "\nCo-authored-by: test2 ") || !strings.Contains(commit, "\nCo-authored-by: test3 ") { - t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test ",commit) + t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test1 \nCo-authored-by: test2 \n\nCo-authored-by: test3 ",commit) } } @@ -79,10 +79,48 @@ func Test_exclude_user(t *testing.T) { commit := sb_build() if strings.Contains(commit, "\nCo-authored-by: test1 ") { - t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test ",commit) + t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test2 \n\nCo-authored-by: test3 ",commit) } } +func Test_exclude_by_default(t *testing.T) { + // Reusing users from before + defExclude = append(defExclude, users["test1"].username) + + sb.Reset() + + add_x_users([]string{}) + + commit := sb_build() + + if strings.Contains(commit, "\nCo-authored-by: test1 ") { + t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test2 \n\nCo-authored-by: test3 ",commit) + } +} + +func Test_commit_with_grouping(t *testing.T) { + for k := range groups { + delete(groups, k) + } + + defExclude = []string{} + + groups["test1"] = []user{users["test1"]} + + excludeMode := group_selection(groups["test1"], []string{}) + + sb.Reset() + + add_x_users(excludeMode) + + commit := sb_build() + + if commit != "\nCo-authored-by: test1 " { + t.Fatalf("String built incorrectly. Strings did not match: Created -> %s Expected -> Co-authored-by: test ",commit) + } + +} + diff --git a/src_code/go_src/go.mod b/src_code/go_src/go.mod new file mode 100644 index 0000000..6abede5 --- /dev/null +++ b/src_code/go_src/go.mod @@ -0,0 +1,3 @@ +module github.com/Slug-Boi/cocommit + +go 1.21.9