merge master

This commit is contained in:
Jesse Duffield 2018-08-08 19:13:13 +10:00
commit e8c4bf20f6
5 changed files with 69 additions and 38 deletions

View file

@ -10,12 +10,11 @@ matrix:
- go: tip - go: tip
allow_failures: allow_failures:
- go: tip - go: tip
- go: 1.7
before_install: before_install:
# Download the binary to bin folder in $GOPATH # 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 -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 - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
- ls
- ls */*
# Make the binary executable # Make the binary executable
- chmod +x $GOPATH/bin/dep - chmod +x $GOPATH/bin/dep
- ls $GOPATH/bin/ - ls $GOPATH/bin/
@ -27,18 +26,19 @@ script:
# - go get -v ./... # - go get -v ./...
# - diff -u <(echo -n) <(gofmt -d .) # can't make gofmt ignore vendor directory # - diff -u <(echo -n) <(gofmt -d .) # can't make gofmt ignore vendor directory
# - go vet $(go list ./... | grep -v /vendor/) # - 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 - 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
- ls - mv lazygit_windows_amd64.exe lazygit_windows_amd64_${TRAVIS_TAG}.exe
- ls */* - mv lazygit_darwin_amd64 lazygit_darwin_amd64_${TRAVIS_TAG}
- mv lazygit_linux_amd64 lazygit_linux_amd64_${TRAVIS_TAG}
deploy: deploy:
provider: releases provider: releases
skip_cleanup: true skip_cleanup: true
api_key: api_key:
secure: TnB8I+swj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HeuBv2u1iU5bu+sI6CORVQzKQwOph9AABDjSZ54wrXIpYEeIW2sz8nx+hiG6QL1mqfM/l+55BR69u3vxKYMryQBxPuzhZCTOqqI4uahlb6GIUNZJ9vGZeIA9HFJq3ymW8cdrpYzhKf3Nx9jK+Yb81h5/AHq9iChXEC63VPCDXXGRllh2UYWNYCaAdtk+ekpLR8299e4CaEregy6g5U2S3/xrBKl87miu1uJ/fquXoxGdSU+JcmsmXZ26sGIU2TCYdNjSfIgpOyfMmB4JNtKHqWRHA9Fe42CRpA=
file: file:
- lazygit.windows.amd64.exe - lazygit_windows_amd64_${TRAVIS_TAG}.exe
- lazygit.darwin.amd64 - lazygit_darwin_amd64_${TRAVIS_TAG}
- lazygit.linux.amd64 - lazygit_linux_amd64_${TRAVIS_TAG}
on: on:
repo: jesseduffield/lazygit repo: jesseduffield/lazygit
tags: true tags: true

30
Gopkg.lock generated
View file

@ -2,10 +2,10 @@
[[projects]] [[projects]]
digest = "1:865079840386857c809b72ce300be7580cb50d3d3129ce11bf9aa6ca2bc1934a" digest = "1:ade392a843b2035effb4b4a2efa2c3bab3eb29b992e98bacf9c898b0ecb54e45"
name = "github.com/fatih/color" name = "github.com/fatih/color"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4" revision = "5b77d2a35fb0ede96d138fc9a99f5c9b6aef11b4"
version = "v1.7.0" version = "v1.7.0"
@ -14,55 +14,55 @@
digest = "1:4a8ed9b8cf22bd03bee5d74179fa06a282e4a73b6de949f7a865ff56cd2537e0" digest = "1:4a8ed9b8cf22bd03bee5d74179fa06a282e4a73b6de949f7a865ff56cd2537e0"
name = "github.com/golang-collections/collections" name = "github.com/golang-collections/collections"
packages = ["stack"] packages = ["stack"]
pruneopts = "UT" pruneopts = "NUT"
revision = "604e922904d35e97f98a774db7881f049cd8d970" revision = "604e922904d35e97f98a774db7881f049cd8d970"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:f086cf183e423bf1926f4de05f47bf57132fe5db9c99e464f733ce925280fc81" digest = "1:82b3bbc50ba7b6065b0229ebf0fc990a76e47410acd510294e435aeb3523293e"
name = "github.com/jesseduffield/gocui" name = "github.com/jesseduffield/gocui"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "3c923f53ac9952af649af04a067405843558d56f" revision = "3c923f53ac9952af649af04a067405843558d56f"
[[projects]] [[projects]]
digest = "1:c658e84ad3916da105a761660dcaeb01e63416c8ec7bc62256a9b411a05fcd67" digest = "1:08c231ec84231a7e23d67e4b58f975e1423695a32467a362ee55a803f9de8061"
name = "github.com/mattn/go-colorable" name = "github.com/mattn/go-colorable"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072" revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
version = "v0.0.9" version = "v0.0.9"
[[projects]] [[projects]]
digest = "1:d4d17353dbd05cb52a2a52b7fe1771883b682806f68db442b436294926bbfafb" digest = "1:bc4f7eec3b7be8c6cb1f0af6c1e3333d5bb71072951aaaae2f05067b0803f287"
name = "github.com/mattn/go-isatty" name = "github.com/mattn/go-isatty"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.3" version = "v0.0.3"
[[projects]] [[projects]]
digest = "1:e2d1d410fb367567c2b53ed9e2d719d3c1f0891397bb2fa49afd747cfbf1e8e4" digest = "1:cb591533458f6eb6e2c1065ff3eac6b50263d7847deb23fc9f79b25bc608970e"
name = "github.com/mattn/go-runewidth" name = "github.com/mattn/go-runewidth"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "9e777a8366cce605130a531d2cd6363d07ad7317" revision = "9e777a8366cce605130a531d2cd6363d07ad7317"
version = "v0.0.2" version = "v0.0.2"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:c9b6e36dbd23f8403a04493376916ca5dad8c01b2da5ae0a05e6a468eb0b6f24" digest = "1:34d9354c2c5d916c05864327553047df59fc10e86ff1f408e4136eba0a25a5ec"
name = "github.com/nsf/termbox-go" name = "github.com/nsf/termbox-go"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "NUT"
revision = "5c94acc5e6eb520f1bcd183974e01171cc4c23b3" revision = "5c94acc5e6eb520f1bcd183974e01171cc4c23b3"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:9ec6ad2659635ba0974dd7e55bf84233523eb4e7535c9a2fddaefc4cc62a3eac" digest = "1:4d8a79fbc6fa348fc94afa4235947c5196b7900ed71b94aa5fcbc7e273d150e1"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = ["unix"] packages = ["unix"]
pruneopts = "UT" pruneopts = "NUT"
revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe" revision = "0ffbfd41fbef8ffcf9b62b0b0aa3a5873ed7a4fe"
[solve-meta] [solve-meta]

View file

@ -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) ![Gif](https://image.ibb.co/mmeXho/optimisedgif.gif)
## Installation ## 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: In a terminal call this command:
`go get github.com/jesseduffield/lazygit` `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). (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: 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 ### Ubuntu
Packages for Ubuntu 16.04 and up are available via Launchpad PPA. 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 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 ## Cool features
- Adding files easily - Adding files easily
- Resolving merge conflicts - Resolving merge conflicts
@ -45,14 +56,12 @@ sudo apt-get install lazygit
### Viewing commit diffs ### Viewing commit diffs
![Viewing Commit Diffs](https://image.ibb.co/gPD02o/capture.png) ![Viewing Commit Diffs](https://image.ibb.co/gPD02o/capture.png)
## Docs
[Keybindings](https://github.com/jesseduffield/lazygit/blob/master/docs/Keybindings.md)
## Milestones ## Milestones
- [ ] Easy Installation (homebrew, release binaries) - [ ] Easy Installation (homebrew, release binaries)
- [ ] Configurable Keybindings - [ ] Configurable Keybindings
- [ ] Configurable Color Themes - [ ] Configurable Color Themes
- [ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18) - [ ] Spawning Subprocesses (help needed - have a look at https://github.com/jesseduffield/lazygit/pull/18)
- [ ] Maintainability
- [ ] Performance - [ ] Performance
- [ ] i18n - [ ] i18n

13
gui.go
View file

@ -226,14 +226,23 @@ func layout(g *gocui.Gui) error {
v.FgColor = gocui.ColorWhite 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 { if err != gocui.ErrUnknownView {
return err return err
} }
v.BgColor = gocui.ColorDefault v.BgColor = gocui.ColorDefault
v.FgColor = gocui.ColorBlue v.FgColor = gocui.ColorBlue
v.Frame = false 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 // these are only called once
handleFileSelect(g, filesView) handleFileSelect(g, filesView)

23
main.go
View file

@ -16,10 +16,20 @@ import (
// ErrSubProcess is raised when we are running a subprocess // ErrSubProcess is raised when we are running a subprocess
var ( var (
startTime time.Time
debugging bool
ErrSubprocess = errors.New("running subprocess") ErrSubprocess = errors.New("running subprocess")
subprocess *exec.Cmd 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 { func homeDirectory() string {
@ -64,11 +74,14 @@ func navigateToRepoRootDirectory() {
} }
func main() { func main() {
debuggingPointer := flag.Bool("debug", false, "a boolean") startTime = time.Now()
flag.Parse()
debugging = *debuggingPointer debugging = *debuggingPointer
devLog("\n\n\n\n\n\n\n\n\n\n") 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() verifyInGitRepo()
navigateToRepoRootDirectory() navigateToRepoRootDirectory()
for { for {