Skip to content

Commit

Permalink
press C to copy the text to clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaysomani07 committed Feb 1, 2023
1 parent 1c20eea commit d439655
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.mod
Expand Up @@ -14,6 +14,8 @@ require (
github.com/spf13/cobra v1.6.1
)

require github.com/atotto/clipboard v0.1.4 // indirect

require (
github.com/aws/aws-sdk-go-v2/credentials v1.13.8 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.21 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
@@ -1,3 +1,5 @@
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/aws/aws-sdk-go v1.44.177 h1:ckMJhU5Gj+4Rta+bJIUiUd7jvHom84aim3zkGPblq0s=
github.com/aws/aws-sdk-go v1.44.177/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go-v2 v1.17.3 h1:shN7NlnVzvDUgPQ+1rLMSxY8OWRNDRYtiqe0p/PgrhY=
Expand Down
11 changes: 11 additions & 0 deletions internal/view/app.go
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"time"

"github.com/atotto/clipboard"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/aws/aws-sdk-go/service/s3"
Expand Down Expand Up @@ -617,6 +618,7 @@ func (a *App) DisplayS3Json(sess *session.Session, bucketName string) {
a.Main.AddAndSwitchToPage("s3Json", flex, true)
flex.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Key() == tcell.KeyESC {
tvForS3Json.SetTextColor(tcell.ColorWhite)
a.Main.SwitchToPage("main")
a.Application.SetFocus(a.Views()["content"].(*tview.Flex).ItemAt(0))
}
Expand All @@ -625,6 +627,15 @@ func (a *App) DisplayS3Json(sess *session.Session, bucketName string) {
}
return event
})
tvForS3Json.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
if event.Rune() == 67 {
tvForS3Json.SetTextColor(tcell.ColorYellowGreen)
text := tvForS3Json.GetText(true)
clipboard.WriteAll(text)
}
return event
})

}

func (a *App) DisplayS3Objects(s3DataTable *tview.Table, flex *tview.Flex, folderName string, fileArrayInfo []string, sess session.Session, bucketName string) {
Expand Down

0 comments on commit d439655

Please sign in to comment.