diff options
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | Gopkg.lock | 30 | ||||
-rw-r--r-- | README.md | 25 | ||||
-rw-r--r-- | gui.go | 13 | ||||
-rw-r--r-- | main.go | 23 |
5 files changed, 69 insertions, 38 deletions
diff --git a/.travis.yml b/.travis.yml index d4f76e1c6..c85fc4806 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,12 +10,11 @@ matrix: - go: tip allow_failures: - go: tip + - go: 1.7 before_install: # Download the binary to bin folder in $GOPATH # - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-386 -o $GOPATH/bin/dep - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - - ls - - ls */* # Make the binary executable - chmod +x $GOPATH/bin/dep - ls $GOPATH/bin/ @@ -27,18 +26,19 @@ script: # - go get -v ./... # - diff -u <(echo -n) <(gofmt -d .) # can't make gofmt ignore vendor directory # - go vet $(go list ./... | grep -v /vendor/) - - if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="amd64" -ldflags "-X main.Rev=`git rev-parse --short HEAD`" -verbose ./...; fi - - ls - - ls */* + - if [ "${LATEST}" = "true" ]; then gox -os="linux darwin windows" -arch="amd64" -ldflags "-X main.Rev=`git rev-parse --short HEAD` -X main.builddate=`date -u +%Y%m%d.%H%M%S` -X main.Version=${TRAVIS_TAG}" -verbose ./...; fi + - mv lazygit_windows_amd64.exe lazygit_windows_amd64_${TRAVIS_TAG}.exe + - mv lazygit_darwin_amd64 lazygit_darwin_amd64_${TRAVIS_TAG} + - mv lazygit_linux_amd64 lazygit_linux_amd64_${TRAVIS_TAG} deploy: provider: releases skip_cleanup: true api_key: secure: TnB8I+swjicHuGTXk3ncm1Aaa12eIJqWV/Lhcnbb01i39p6+fyn3vDMdWPcejt3R8gcJqv4wyP8UQVO9G1qkLppt6V/qAuY5x6nX0MgEa3t+8JLJnGYHZYsuIgan/ecAmeu5+6dgUhr9Oq6zQOEv/O88NsALzMlqnEQNXI8XSoScfhkiVDIp3zWov0vBizCdThnNgTx9zRpJVoqxmhWvgt+me2+fOhSx1Y+3ZA2gE7zq8IFAbxp36d0rsR5lKqmTuF+YsF9iQ7Ar+xCjbRunLsZx+VwGqGfpS/qS7EwsEqBI0vEO76eFJkwEsIzOvJiFNhBDUu3upquBFMT4uzxRxH3eV+J4mZtu29UDLdvKI5Q730Lk9AgmH4now+RmP08M0SEXJa+AnHeuBv2u1iU5bu+sI6CORVQzKQwOph9AABDjSZ54wrXIpYEeIW2sz8nx+hiG6QL1mqfM/l+55BR69u3vxKYMryQBxPuzhZCTOqqI4uahlb6GIUNZJ9vGZeIA9HFJq3ymW8cdrpYzhKf3Nx9jK+Yb81h5/AHq9iChXEC63VPCDXXGRllh2UYWNYCaAdtk+ekpLR8299e4CaEregy6g5U2S3/xrBKl87miu1uJ/fquXoxGdSU+JcmsmXZ26sGIU2TCYdNjSfIgpOyfMmB4JNtKHqWRHA9Fe42CRpA= file: - - lazygit.windows.amd64.exe - - lazygit.darwin.amd64 - - lazygit.linux.amd64 + - lazygit_windows_amd64_${TRAVIS_TAG}.exe + - lazygit_darwin_amd64_${TRAVIS_TAG} + - lazygit_linux_amd64_${TRAVIS_TAG} on: repo: jesseduffield/lazygit tags: true diff --git a/Gopkg.lock b/Gopkg.lock index e6981327e..9a564e42a 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -2,10 +2,10 @@ [[projects]] - digest = "1:865079840386857c809b72ce300be7580cb50d3d3129ce11bf9aa6ca2bc1934a" + digest = "1:ade392a843b2035effb4b4a2efa2c3bab3eb29b992e98bacf9c898b0ecb54e45" name = "github.com/fatih/color" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4" version = "v1.7.0" @@ -14,55 +14,55 @@ digest = "1:4a8ed9b8cf22bd03bee5d74179fa06a282e4a73b6de949f7a865ff56cd2537e0" name = "github.com/golang-collections/collections" packages = ["stack"] - pruneopts = "UT" + pruneopts = "NUT" revision = "604e922904d35e97f98a774db7881f049cd8d970" [[projects]] branch = "master" - digest = "1:f086cf183e423bf1926f4de05f47bf57132fe5db9c99e464f733ce925280fc81" + digest = "1:82b3bbc50ba7b6065b0229ebf0fc990a76e47410acd510294e435aeb3523293e" name = "github.com/jesseduffield/gocui" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "3c923f53ac9952af649af04a067405843558d56f" [[projects]] - digest = "1:c658e84ad3916da105a761660dcaeb01e63416c8ec7bc62256a9b411a05fcd67" + digest = "1:08c231ec84231a7e23d67e4b58f975e1423695a32467a362ee55a803f9de8061" name = "github.com/mattn/go-colorable" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" version = "v0.0.9" [[projects]] - digest = "1:d4d17353dbd05cb52a2a52b7fe1771883b682806f68db442b436294926bbfafb" + digest = "1:bc4f7eec3b7be8c6cb1f0af6c1e3333d5bb71072951aaaae2f05067b0803f287" name = "github.com/mattn/go-isatty" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" version = "v0.0.3" [[projects]] - digest = "1:e2d1d410fb367567c2b53ed9e2d719d3c1f0891397bb2fa49afd747cfbf1e8e4" + digest = "1:cb591533458f6eb6e2c1065ff3eac6b50263d7847deb23fc9f79b25bc608970e" name = "github.com/mattn/go-runewidth" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "9e777a8366cce605130a531d2cd6363d07ad7317" version = "v0.0.2" [[projects]] branch = "master" - digest = "1:c9b6e36dbd23f8403a04493376916ca5dad8c01b2da5ae0a05e6a468eb0b6f24" + digest = "1:34d9354c2c5d916c05864327553047df59fc10e86ff1f408e4136eba0a25a5ec" name = "github.com/nsf/termbox-go" packages = ["."] - pruneopts = "UT" + pruneopts = "NUT" revision = "5c94acc5e6eb520f1bcd183974e01171cc4c23b3" [[projects]] branch = "master" - digest = "1:9ec6ad2659635ba0974dd7e55bf84233523eb4e7535c9a2fddaefc4cc62a3eac" + digest = "1:4d8a79fbc6fa348fc94afa4235947c5196b7900ed71b94aa5fcbc7e273d150e1" name = "golang.org/x/sys" packages = ["unix"] - pruneopts = "UT" + pruneopts = "NUT" revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe" [solve-meta] @@ -9,16 +9,20 @@ Are YOU tired of typing every git command directly into the terminal, but you're ![Gif](https://image.ibb.co/mmeXho/optimisedgif.gif) ## Installation + +### Via binary release +You can download a binary release [here](https://github.com/jesseduffield/lazygit/releases) +You may need to grant execute permission via `chmod +x ./<filename>`. +You can move this file to your local /bin directory and rename to `lazygit` so that you can run it anywhere +(Easier-install coming soon) + +### Via Go In a terminal call this command: `go get github.com/jesseduffield/lazygit` (if you don't have Go installed, you can follow the installation guide [here](https://golang.org/doc/install). -Then just call `lazygit` in your terminal inside a git repository. - -If you want, you can also add an alias for this with `echo "alias lg='lazygit'" >> ~/.zshrc` (or whichever rc file you're using). - Please note: -If you get an error claiming that lazygit cannot be found or is not defined, you may need to add `~/go/bin` to your $PATH (MacOS/Linux), or `%HOME%\go\bin` (Windows) +If you get an error claiming that lazygit cannot be found or is not defined, you may need to add `~/go/bin` to your $PATH (MacOS/Linux), or `%HOME%\go\bin` (Windows). Not to be mistaked for `C:\Go\bin` (which is for Go's own binaries, not apps like Lazygit) ### Ubuntu Packages for Ubuntu 16.04 and up are available via Launchpad PPA. @@ -31,6 +35,13 @@ sudo apt-get update sudo apt-get install lazygit ``` + +## Usage +Call `lazygit` in your terminal inside a git repository. +If you want, you can also add an alias for this with `echo "alias lg='lazygit'" >> ~/.zshrc` (or whichever rc file you're using). +Basic tutorial [Here](https://www.youtube.com/watch?v=VDXvbHZYeKY) +[Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md) + ## Cool features - Adding files easily - Resolving merge conflicts @@ -45,14 +56,12 @@ sudo apt-get install lazygit ### Viewing commit diffs ![Viewing Commit Diffs](https://image.ibb.co/gPD02o/capture.png) -## Docs -[Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md) - ## Milestones - [ ] Easy Installation (homebrew, release binaries) - [ ] Configurable Keybindings - [ ] Configurable Color Themes - [ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18) +- [ ] Maintainability - [ ] Performance - [ ] i18n @@ -226,14 +226,23 @@ func layout(g *gocui.Gui) error { v.FgColor = gocui.ColorWhite } - if v, err := g.SetView("options", -1, optionsTop, width, optionsTop+2, 0); err != nil { + if v, err := g.SetView("options", -1, optionsTop, width-len(Version)-2, optionsTop+2, 0); err != nil { if err != gocui.ErrUnknownView { return err } v.BgColor = gocui.ColorDefault v.FgColor = gocui.ColorBlue v.Frame = false - v.Title = "Options" + } + + if v, err := g.SetView("version", width-len(Version)-1, optionsTop, width, optionsTop+2, 0); err != nil { + if err != gocui.ErrUnknownView { + return err + } + v.BgColor = gocui.ColorDefault + v.FgColor = gocui.ColorGreen + v.Frame = false + renderString(g, "version", Version) // these are only called once handleFileSelect(g, filesView) @@ -16,10 +16,20 @@ import ( // ErrSubProcess is raised when we are running a subprocess var ( - startTime time.Time - debugging bool ErrSubprocess = errors.New("running subprocess") subprocess *exec.Cmd + startTime time.Time + debugging bool + + // Rev - Git Revision + Rev string + + // Version - Version number + Version = "unversioned" + + builddate string + debuggingPointer = flag.Bool("debug", false, "a boolean") + versionFlag = flag.Bool("v", false, "Print the current version") ) func homeDirectory() string { @@ -64,11 +74,14 @@ func navigateToRepoRootDirectory() { } func main() { - debuggingPointer := flag.Bool("debug", false, "a boolean") - flag.Parse() + startTime = time.Now() debugging = *debuggingPointer devLog("\n\n\n\n\n\n\n\n\n\n") - startTime = time.Now() + flag.Parse() + if *versionFlag { + fmt.Printf("rev=%s, build date=%s, version=%s", Rev, builddate, Version) + os.Exit(0) + } verifyInGitRepo() navigateToRepoRootDirectory() for { |