github.com/kristofferahl/go-centry@v1.5.0/cmd/centry/main.go (about)

     1  package main
     2  
     3  import (
     4  	"log"
     5  	"os"
     6  
     7  	"github.com/kristofferahl/go-centry/internal/pkg/config"
     8  	"github.com/kristofferahl/go-centry/internal/pkg/io"
     9  )
    10  
    11  func main() {
    12  	args := os.Args[1:]
    13  
    14  	// Create the context
    15  	context := NewContext(CLI, io.Standard())
    16  
    17  	// Create the runtime
    18  	runtime, err := NewRuntime(args, context)
    19  	if err != nil {
    20  		log.Fatalf("Error: %v", err)
    21  	}
    22  
    23  	if len(runtime.args) == 0 && context.manifest.Config.HelpMode == config.HelpModeInteractive {
    24  		interactive(runtime)
    25  	}
    26  
    27  	// Run and exit
    28  	os.Exit(runtime.Execute())
    29  }