github.com/markusbkk/elvish@v0.0.0-20231204143114-91dc52438621/cmd/elvish/main.go (about)

     1  // Elvish is a cross-platform shell, supporting Linux, BSDs and Windows. It
     2  // features an expressive programming language, with features like namespacing
     3  // and anonymous functions, and a fully programmable user interface with
     4  // friendly defaults. It is suitable for both interactive use and scripting.
     5  package elvish
     6  
     7  import (
     8  	"os"
     9  
    10  	"github.com/markusbkk/elvish/pkg/buildinfo"
    11  	"github.com/markusbkk/elvish/pkg/daemon"
    12  	"github.com/markusbkk/elvish/pkg/lsp"
    13  	"github.com/markusbkk/elvish/pkg/prog"
    14  	"github.com/markusbkk/elvish/pkg/shell"
    15  	"github.com/icexin/eggos/app"
    16  )
    17  
    18  func elvish(ctx *app.Context) error {
    19  	err := ctx.ParseFlags()
    20  	if err != nil {
    21  		return err
    22  	}
    23  	os.Exit(prog.Run(
    24  		[3]*os.File{os.Stdin, os.Stdout, os.Stderr}, os.Args,
    25  		prog.Composite(
    26  			&buildinfo.Program{}, &daemon.Program{}, &lsp.Program{},
    27  			&shell.Program{ActivateDaemon: daemon.Activate})))
    28  	return nil
    29  }
    30  
    31  func init() {
    32  	app.Register("elvish", elvish)
    33  }