Skip to content

Commit

Permalink
Remove copy to clipboard due to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinatedpixel committed Jul 2, 2024
1 parent c3b723f commit b3db023
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/testcontainers/testcontainers-go/modules/compose v0.31.0
github.com/urfave/cli/v2 v2.27.2
github.com/vbauerster/mpb/v8 v8.7.3
golang.design/x/clipboard v0.7.0
golang.org/x/sync v0.7.0
golang.org/x/text v0.16.0
golang.org/x/time v0.5.0
Expand Down Expand Up @@ -221,9 +220,6 @@ require (
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 // indirect
golang.org/x/exp/shiny v0.0.0-20240525044651-4c93da0ed11d // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sys v0.20.0 // indirect
Expand Down
8 changes: 0 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,6 @@ go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.design/x/clipboard v0.7.0 h1:4Je8M/ys9AJumVnl8m+rZnIvstSnYj1fvzqYrU3TXvo=
golang.design/x/clipboard v0.7.0/go.mod h1:PQIvqYO9GP29yINEfsEn5zSQKAz3UgXmZKzDA6dnq2E=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand All @@ -690,15 +688,9 @@ golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3 h1:hNQpMuAJe5CtcUqCXaWga3FHu+kQvCqcsoVaQgSV60o=
golang.org/x/exp v0.0.0-20240112132812-db7319d0e0e3/go.mod h1:idGWGoKP1toJGkd5/ig9ZLuPcZBC3ewk7SzmH0uou08=
golang.org/x/exp/shiny v0.0.0-20240525044651-4c93da0ed11d h1:NRBIrtUw7ZKcccaGmvwwMUwGTFGx6tVCtB+etaxQE5Q=
golang.org/x/exp/shiny v0.0.0-20240525044651-4c93da0ed11d/go.mod h1:3F+MieQB7dRYLTmnncoFbb1crS5lfQoTfDgQy6K4N0o=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b h1:WX7nnnLfCEXg+FmdYZPai2XuP3VqCP1HZVMST0n9DF0=
golang.org/x/mobile v0.0.0-20240520174638-fa72addaaa1b/go.mod h1:EiXZlVfUTaAyySFVJb9rsODuiO+WXu8HrUuySb7nYFw=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
Expand Down
28 changes: 1 addition & 27 deletions viewer/viewer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package viewer
import (
"activecm/rita/config"
"activecm/rita/database"
"encoding/json"
"fmt"
"math"
"os"
Expand All @@ -17,7 +16,6 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/lipgloss/table"
"golang.design/x/clipboard"
)

var DebugMode bool
Expand Down Expand Up @@ -52,7 +50,6 @@ type keyMap struct {
unfocusFilter key.Binding
toggleScroll key.Binding
quit key.Binding
copy key.Binding
}

type column struct {
Expand Down Expand Up @@ -170,11 +167,6 @@ func (m *Model) Init() tea.Cmd {
key.WithHelp("q | ctrl+c", "quit"),
)

m.keys.copy = key.NewBinding(
key.WithKeys("C"),
key.WithHelp("shift+c", "copy line"),
)

return m.Footer.spinner.Tick
}

Expand Down Expand Up @@ -210,10 +202,6 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.ViewHelp = !m.ViewHelp
}

// copy row to clipboard
case key.Matches(msg, m.keys.copy):
m.CopyRowToClipboard()

// focus search bar
case key.Matches(msg, m.keys.filter):
m.SearchBar.Focus()
Expand Down Expand Up @@ -410,18 +398,6 @@ func (m *Model) handleBrowsing(msg tea.KeyMsg) tea.Cmd {

}

func (m *Model) CopyRowToClipboard() {
if err := clipboard.Init(); err != nil {
// handle error
panic(err)
}
row := m.List.Rows.Items()[m.List.Rows.Index()]
a, err := json.Marshal(row)
if err == nil {
clipboard.Write(clipboard.FmtText, a)
}
}

// requestResults queries the database for results based on the search bar filter
func (m *Model) requestResults(appendResults bool) {

Expand Down Expand Up @@ -604,9 +580,7 @@ func mainHelpText() string {

helpText = lipgloss.JoinVertical(lipgloss.Top, helpText, helpStyle.Render(
helpStyle.Render("ctrl+x"), subduedHelpStyle.Render("clear filter"),
subduedHelpStyle.Render(bullet),
helpStyle.Render("shift+c"), subduedHelpStyle.Render("copy")),
)
))

return lipgloss.NewStyle().Margin(1, 0, 0, 2).Render(helpText)

Expand Down

0 comments on commit b3db023

Please sign in to comment.