Merge remote-tracking branch 'origin/feature/dynamo-query'
# Conflicts: # cmd/dynamo-browse/main.go # cmd/ssm-browse/main.go # docker-compose.yml # internal/dynamo-browse/ui/model.go # test/cmd/load-test-table/main.go
This commit is contained in:
commit
ffca588a2c
77 changed files with 2986 additions and 572 deletions
|
|
@ -10,18 +10,21 @@ import (
|
|||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/common/ui/commandctrl"
|
||||
"github.com/lmika/awstools/internal/common/ui/logging"
|
||||
"github.com/lmika/awstools/internal/common/ui/osstyle"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/controllers"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/providers/dynamo"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/services/tables"
|
||||
"github.com/lmika/awstools/internal/dynamo-browse/ui"
|
||||
"github.com/lmika/gopkgs/cli"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var flagTable = flag.String("t", "", "dynamodb table name")
|
||||
var flagLocal = flag.Bool("local", false, "local endpoint")
|
||||
var flagLocal = flag.String("local", "", "local endpoint")
|
||||
var flagDebug = flag.String("debug", "", "file to log debug messages")
|
||||
flag.Parse()
|
||||
|
||||
ctx := context.Background()
|
||||
|
|
@ -32,9 +35,19 @@ func main() {
|
|||
}
|
||||
|
||||
var dynamoClient *dynamodb.Client
|
||||
if *flagLocal {
|
||||
if *flagLocal != "" {
|
||||
host, port, err := net.SplitHostPort(*flagLocal)
|
||||
if err != nil {
|
||||
cli.Fatalf("invalid address '%v': %v", *flagLocal, err)
|
||||
}
|
||||
if host == "" {
|
||||
host = "localhost"
|
||||
}
|
||||
if port == "" {
|
||||
port = "8000"
|
||||
}
|
||||
dynamoClient = dynamodb.NewFromConfig(cfg,
|
||||
dynamodb.WithEndpointResolver(dynamodb.EndpointResolverFromURL("http://localhost:4566")))
|
||||
dynamodb.WithEndpointResolver(dynamodb.EndpointResolverFromURL(fmt.Sprintf("http://%v:%v", host, port))))
|
||||
} else {
|
||||
dynamoClient = dynamodb.NewFromConfig(cfg)
|
||||
}
|
||||
|
|
@ -57,6 +70,23 @@ func main() {
|
|||
closeFn := logging.EnableLogging()
|
||||
defer closeFn()
|
||||
|
||||
// Pre-determine if layout has dark background. This prevents calls for creating a list to hang.
|
||||
if lipgloss.HasDarkBackground() {
|
||||
if colorScheme := osstyle.CurrentColorScheme(); colorScheme == osstyle.ColorSchemeLightMode {
|
||||
log.Printf("terminal reads dark but really in light mode")
|
||||
lipgloss.SetHasDarkBackground(true)
|
||||
} else {
|
||||
log.Printf("in dark background")
|
||||
}
|
||||
} else {
|
||||
if colorScheme := osstyle.CurrentColorScheme(); colorScheme == osstyle.ColorSchemeDarkMode {
|
||||
log.Printf("terminal reads light but really in dark mode")
|
||||
lipgloss.SetHasDarkBackground(true)
|
||||
} else {
|
||||
log.Printf("cannot detect system darkmode")
|
||||
}
|
||||
}
|
||||
|
||||
log.Println("launching")
|
||||
if err := p.Start(); err != nil {
|
||||
fmt.Printf("Alas, there's been an error: %v", err)
|
||||
|
|
|
|||
|
|
@ -7,14 +7,15 @@ import (
|
|||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/lmika/awstools/internal/common/ui/commandctrl"
|
||||
"github.com/lmika/awstools/internal/common/ui/logging"
|
||||
"github.com/lmika/awstools/internal/slog-view/services/logreader"
|
||||
"github.com/lmika/awstools/internal/slog-view/controllers"
|
||||
"github.com/lmika/awstools/internal/slog-view/services/logreader"
|
||||
"github.com/lmika/awstools/internal/slog-view/ui"
|
||||
"github.com/lmika/gopkgs/cli"
|
||||
"os"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var flagDebug = flag.String("debug", "", "file to log debug messages")
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() == 0 {
|
||||
|
|
@ -24,7 +25,7 @@ func main() {
|
|||
// Pre-determine if layout has dark background. This prevents calls for creating a list to hang.
|
||||
lipgloss.HasDarkBackground()
|
||||
|
||||
closeFn := logging.EnableLogging()
|
||||
closeFn := logging.EnableLogging(*flagDebug)
|
||||
defer closeFn()
|
||||
|
||||
service := logreader.NewService()
|
||||
|
|
|
|||
|
|
@ -20,12 +20,13 @@ import (
|
|||
|
||||
func main() {
|
||||
var flagLocal = flag.Bool("local", false, "local endpoint")
|
||||
var flagDebug = flag.String("debug", "", "file to log debug messages")
|
||||
flag.Parse()
|
||||
|
||||
// Pre-determine if layout has dark background. This prevents calls for creating a list to hang.
|
||||
lipgloss.HasDarkBackground()
|
||||
|
||||
closeFn := logging.EnableLogging()
|
||||
closeFn := logging.EnableLogging(*flagDebug)
|
||||
defer closeFn()
|
||||
|
||||
cfg, err := config.LoadDefaultConfig(context.Background())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue