Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions cmd/entire/main.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
package main

import (
"context"
"errors"
"fmt"
"os"
"os/signal"
"strings"
"syscall"

"github.com/entireio/cli/cmd/entire/cli"
"github.com/spf13/cobra"
)

func main() {
// Create context that cancels on interrupt
ctx, cancel := context.WithCancel(context.Background())

// Handle interrupt signals
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
go func() {
<-sigChan
cancel()
}()

// Create and execute root command
rootCmd := cli.NewRootCmd()
err := rootCmd.ExecuteContext(ctx)
err := rootCmd.Execute()

if err != nil {
var silent *cli.SilentError
Expand All @@ -41,10 +26,8 @@ func main() {
fmt.Fprintln(rootCmd.OutOrStderr(), err)
}

cancel()
os.Exit(1)
}
cancel() // Cleanup on successful exit
}

func showSuggestion(cmd *cobra.Command, err error) {
Expand Down