Add wrapping tree key
This commit is contained in:
parent
3430221ada
commit
aadcbcb443
9
Makefile
9
Makefile
@ -5,7 +5,7 @@ PWD := ${CURDIR}
|
|||||||
PRODUCTION_REGISTRY = docker.io
|
PRODUCTION_REGISTRY = docker.io
|
||||||
TEST_IMAGE = busybox:latest
|
TEST_IMAGE = busybox:latest
|
||||||
|
|
||||||
all: clean build
|
all: gofmt clean build
|
||||||
|
|
||||||
## For CI
|
## For CI
|
||||||
|
|
||||||
@ -119,13 +119,13 @@ run-podman-large: build
|
|||||||
run-ci: build
|
run-ci: build
|
||||||
CI=true $(BUILD_PATH) dive-example:latest --ci-config .data/.dive-ci
|
CI=true $(BUILD_PATH) dive-example:latest --ci-config .data/.dive-ci
|
||||||
|
|
||||||
build:
|
build: gofmt
|
||||||
go build -o $(BUILD_PATH)
|
go build -o $(BUILD_PATH)
|
||||||
|
|
||||||
generate-test-data:
|
generate-test-data:
|
||||||
docker build -t dive-test:latest -f .data/Dockerfile.test-image . && docker image save -o .data/test-docker-image.tar dive-test:latest && echo 'Exported test data!'
|
docker build -t dive-test:latest -f .data/Dockerfile.test-image . && docker image save -o .data/test-docker-image.tar dive-test:latest && echo 'Exported test data!'
|
||||||
|
|
||||||
test:
|
test: gofmt
|
||||||
./.scripts/test-coverage.sh
|
./.scripts/test-coverage.sh
|
||||||
|
|
||||||
dev:
|
dev:
|
||||||
@ -135,4 +135,5 @@ clean:
|
|||||||
rm -rf dist
|
rm -rf dist
|
||||||
go clean
|
go clean
|
||||||
|
|
||||||
|
gofmt:
|
||||||
|
go fmt -x ./...
|
||||||
|
@ -2,13 +2,14 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/wagoodman/dive/dive"
|
|
||||||
"github.com/wagoodman/dive/dive/filetree"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/wagoodman/dive/dive"
|
||||||
|
"github.com/wagoodman/dive/dive/filetree"
|
||||||
|
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -90,6 +91,7 @@ func initConfig() {
|
|||||||
viper.SetDefault("keybinding.toggle-removed-files", "ctrl+r")
|
viper.SetDefault("keybinding.toggle-removed-files", "ctrl+r")
|
||||||
viper.SetDefault("keybinding.toggle-modified-files", "ctrl+m")
|
viper.SetDefault("keybinding.toggle-modified-files", "ctrl+m")
|
||||||
viper.SetDefault("keybinding.toggle-unmodified-files", "ctrl+u")
|
viper.SetDefault("keybinding.toggle-unmodified-files", "ctrl+u")
|
||||||
|
viper.SetDefault("keybinding.toggle-wrap-tree", "ctrl+p")
|
||||||
viper.SetDefault("keybinding.page-up", "pgup")
|
viper.SetDefault("keybinding.page-up", "pgup")
|
||||||
viper.SetDefault("keybinding.page-down", "pgdn")
|
viper.SetDefault("keybinding.page-down", "pgdn")
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ package view
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
|
||||||
"github.com/jroimartin/gocui"
|
"github.com/jroimartin/gocui"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -10,7 +12,6 @@ import (
|
|||||||
"github.com/wagoodman/dive/runtime/ui/key"
|
"github.com/wagoodman/dive/runtime/ui/key"
|
||||||
"github.com/wagoodman/dive/runtime/ui/viewmodel"
|
"github.com/wagoodman/dive/runtime/ui/viewmodel"
|
||||||
"github.com/wagoodman/dive/utils"
|
"github.com/wagoodman/dive/utils"
|
||||||
"regexp"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ViewOptionChangeListener func() error
|
type ViewOptionChangeListener func() error
|
||||||
@ -126,6 +127,12 @@ func (v *FileTree) Setup(view *gocui.View, header *gocui.View) error {
|
|||||||
IsSelected: func() bool { return v.vm.ShowAttributes },
|
IsSelected: func() bool { return v.vm.ShowAttributes },
|
||||||
Display: "Attributes",
|
Display: "Attributes",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ConfigKeys: []string{"keybinding.toggle-wrap-tree"},
|
||||||
|
OnAction: v.toggleWrapTree,
|
||||||
|
IsSelected: func() bool { return v.view.Wrap },
|
||||||
|
Display: "Wrap",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ConfigKeys: []string{"keybinding.page-up"},
|
ConfigKeys: []string{"keybinding.page-up"},
|
||||||
OnAction: v.PageUp,
|
OnAction: v.PageUp,
|
||||||
@ -280,6 +287,11 @@ func (v *FileTree) toggleCollapseAll() error {
|
|||||||
return v.Render()
|
return v.Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (v *FileTree) toggleWrapTree() error {
|
||||||
|
v.view.Wrap = !v.view.Wrap
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (v *FileTree) notifyOnViewOptionChangeListeners() error {
|
func (v *FileTree) notifyOnViewOptionChangeListeners() error {
|
||||||
for _, listener := range v.listeners {
|
for _, listener := range v.listeners {
|
||||||
err := listener()
|
err := listener()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user