Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
update: add tab to secman list short help view, update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
abdfnx committed Mar 24, 2022
1 parent 4964222 commit 132da07
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:

jobs:
bfs: # build from source
runs-on: macos-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Expand Down
22 changes: 22 additions & 0 deletions pkg/pipe/lister/lister.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package lister

import (
"github.com/abdfnx/bubbles/list"
"github.com/charmbracelet/bubbles/key"
"github.com/scmn-dev/secman/constants"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/bubbles/spinner"
Expand Down Expand Up @@ -113,6 +114,11 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
}

func Lister() *model {
var tab = key.NewBinding(
key.WithKeys("tab"),
key.WithHelp("tab", "switch"),
)

loginPWs := conf.PWs("-l")
ccPWs := conf.PWs("-c")
emailPWs := conf.PWs("-e")
Expand All @@ -125,29 +131,45 @@ func Lister() *model {
l.SetShowFilter(false)
l.SetFilteringEnabled(false)

l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{tab}
}

c := list.NewModel(ccPWs, list.NewDefaultDelegate(), constants.SECMAN_LIST_WIDTH, constants.SECMAN_LIST_HEIGHT)
c.Title = "Credit Cards List"
c.Styles.Title = st.ListTitle
c.SetShowFilter(false)
c.SetFilteringEnabled(false)
c.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{tab}
}

e := list.NewModel(emailPWs, list.NewDefaultDelegate(), constants.SECMAN_LIST_WIDTH, constants.SECMAN_LIST_HEIGHT)
e.Title = "Emails List"
e.Styles.Title = st.ListTitle
e.SetShowFilter(false)
e.SetFilteringEnabled(false)
e.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{tab}
}

n := list.NewModel(notePWs, list.NewDefaultDelegate(), constants.SECMAN_LIST_WIDTH, constants.SECMAN_LIST_HEIGHT)
n.Title = "Notes List"
n.Styles.Title = st.ListTitle
n.SetShowFilter(false)
n.SetFilteringEnabled(false)
n.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{tab}
}

r := list.NewModel(serverPWs, list.NewDefaultDelegate(), constants.SECMAN_LIST_WIDTH, constants.SECMAN_LIST_HEIGHT)
r.Title = "Servers List"
r.Styles.Title = st.ListTitle
r.SetShowFilter(false)
r.SetFilteringEnabled(false)
r.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{tab}
}

s := spinner.New()
s.Spinner = spinner.Dot
Expand Down
5 changes: 1 addition & 4 deletions pkg/pipe/lister/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,5 @@ func (m model) detailView() string {
func (m model) View() string {
m.viewport.SetContent(m.detailView())

return lipgloss.JoinVertical(
lipgloss.Center,
lipgloss.JoinHorizontal(lipgloss.Top, m.listView(), m.viewport.View()),
)
return lipgloss.JoinHorizontal(lipgloss.Bottom, m.listView(), m.viewport.View())
}

0 comments on commit 132da07

Please sign in to comment.