First commit of golang CLI.

This commit is contained in:
2025-08-31 11:51:11 -07:00
parent 4ca06aecb6
commit f0a2098f11
51 changed files with 8840 additions and 0 deletions

38
wild-cli/cmd/wild/main.go Normal file
View File

@@ -0,0 +1,38 @@
package main
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/wild-cloud/wild-cli/internal/output"
)
func main() {
// Set up context with cancellation for graceful shutdown
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// Handle interrupt signals gracefully
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
go func() {
<-sigChan
cancel()
os.Exit(1)
}()
// Initialize output logger
logger := output.NewLogger()
defer func() {
_ = logger.Sync() // Ignore sync errors on program exit
}()
// Execute root command
cmd := newRootCommand()
if err := cmd.ExecuteContext(ctx); err != nil {
logger.Error("Command execution failed", "error", err)
os.Exit(1)
}
}