A few small changes made while writing the documentation
This commit is contained in:
parent
57e1280329
commit
77f84449f3
21
.github/workflows/release.yaml
vendored
21
.github/workflows/release.yaml
vendored
|
@ -6,15 +6,8 @@ on:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
services:
|
|
||||||
localstack:
|
|
||||||
image: localstack/localstack
|
|
||||||
ports:
|
|
||||||
- "4566:4566"
|
|
||||||
env:
|
|
||||||
SERVICES: ssm,dynamodb
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -32,18 +25,6 @@ jobs:
|
||||||
go test -p 1 ./...
|
go test -p 1 ./...
|
||||||
env:
|
env:
|
||||||
GOPRIVATE: "github:com/lmika/*"
|
GOPRIVATE: "github:com/lmika/*"
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup Go
|
|
||||||
uses: actions/setup-go@v2
|
|
||||||
with:
|
|
||||||
go-version: 1.18
|
|
||||||
- name: Configure
|
|
||||||
run: |
|
|
||||||
git config --global url."https://${{ secrets.GO_MODULES_TOKEN }}:x-oauth-basic@github.com/lmika".insteadOf "https://github.com/lmika"
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: goreleaser/goreleaser-action@v1
|
uses: goreleaser/goreleaser-action@v1
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package dynamotableview
|
||||||
|
|
||||||
|
type columnModel struct {
|
||||||
|
m *Model
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cm columnModel) Len() int {
|
||||||
|
return len(cm.m.resultSet.Columns()[cm.m.colOffset:]) + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func (cm columnModel) Header(index int) string {
|
||||||
|
if index == 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
return cm.m.resultSet.Columns()[cm.m.colOffset+index-1]
|
||||||
|
}
|
|
@ -43,18 +43,6 @@ type Model struct {
|
||||||
resultSet *models.ResultSet
|
resultSet *models.ResultSet
|
||||||
}
|
}
|
||||||
|
|
||||||
type columnModel struct {
|
|
||||||
m *Model
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cm columnModel) Len() int {
|
|
||||||
return len(cm.m.resultSet.Columns()[cm.m.colOffset:])
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cm columnModel) Header(index int) string {
|
|
||||||
return cm.m.resultSet.Columns()[cm.m.colOffset+index]
|
|
||||||
}
|
|
||||||
|
|
||||||
func New(uiStyles styles.Styles) *Model {
|
func New(uiStyles styles.Styles) *Model {
|
||||||
tbl := table.New(table.SimpleColumns([]string{"pk", "sk"}), 100, 100)
|
tbl := table.New(table.SimpleColumns([]string{"pk", "sk"}), 100, 100)
|
||||||
rows := make([]table.Row, 0)
|
rows := make([]table.Row, 0)
|
||||||
|
@ -70,8 +58,8 @@ func New(uiStyles styles.Styles) *Model {
|
||||||
MoveDown: key.NewBinding(key.WithKeys("k", "down")),
|
MoveDown: key.NewBinding(key.WithKeys("k", "down")),
|
||||||
PageUp: key.NewBinding(key.WithKeys("I", "pgup")),
|
PageUp: key.NewBinding(key.WithKeys("I", "pgup")),
|
||||||
PageDown: key.NewBinding(key.WithKeys("K", "pgdown")),
|
PageDown: key.NewBinding(key.WithKeys("K", "pgdown")),
|
||||||
Home: key.NewBinding(key.WithKeys("I", "home")),
|
Home: key.NewBinding(key.WithKeys("0", "home")),
|
||||||
End: key.NewBinding(key.WithKeys("K", "end")),
|
End: key.NewBinding(key.WithKeys("$", "end")),
|
||||||
ColLeft: key.NewBinding(key.WithKeys("j", "left")),
|
ColLeft: key.NewBinding(key.WithKeys("j", "left")),
|
||||||
ColRight: key.NewBinding(key.WithKeys("l", "right")),
|
ColRight: key.NewBinding(key.WithKeys("l", "right")),
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,7 +16,7 @@ var (
|
||||||
dirtyRowStyle = lipgloss.NewStyle().
|
dirtyRowStyle = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#e13131"))
|
Foreground(lipgloss.Color("#e13131"))
|
||||||
newRowStyle = lipgloss.NewStyle().
|
newRowStyle = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#31e131"))
|
Foreground(lipgloss.AdaptiveColor{Light: "#2B800C", Dark: "#73C653"})
|
||||||
|
|
||||||
metaInfoStyle = lipgloss.NewStyle().
|
metaInfoStyle = lipgloss.NewStyle().
|
||||||
Foreground(lipgloss.Color("#888888"))
|
Foreground(lipgloss.Color("#888888"))
|
||||||
|
@ -50,6 +50,19 @@ func (mtr itemTableRow) Render(w io.Writer, model table.Model, index int) {
|
||||||
metaInfoStyle := style.Copy().Inherit(metaInfoStyle)
|
metaInfoStyle := style.Copy().Inherit(metaInfoStyle)
|
||||||
|
|
||||||
sb := strings.Builder{}
|
sb := strings.Builder{}
|
||||||
|
|
||||||
|
// The status column
|
||||||
|
switch {
|
||||||
|
case isNew:
|
||||||
|
sb.WriteString(style.Render("*\t"))
|
||||||
|
case isDirty:
|
||||||
|
sb.WriteString(style.Render("M\t"))
|
||||||
|
case isMarked:
|
||||||
|
sb.WriteString(style.Render("•\t"))
|
||||||
|
default:
|
||||||
|
sb.WriteString(metaInfoStyle.Render("⋅\t"))
|
||||||
|
}
|
||||||
|
|
||||||
for i, colName := range mtr.resultSet.Columns()[mtr.model.colOffset:] {
|
for i, colName := range mtr.resultSet.Columns()[mtr.model.colOffset:] {
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
sb.WriteString(style.Render("\t"))
|
sb.WriteString(style.Render("\t"))
|
||||||
|
|
Loading…
Reference in a new issue