Skip to content
Snippets Groups Projects
Select Git revision
  • 2112f5d826e913d7d7481fdaf36ebafe4e9929ec
  • release default protected
  • more-testing
  • attempt-vax90b1
  • attempt-1
  • conversion protected
  • linux
  • v0.9.1 protected
  • v0.9.0 protected
9 results

main.go

  • main.go 933 B
    // Package main is the main program for bulletin.
    // It is based off the 1989 version of bulletin.
    package main
    
    import (
    	"context"
    	"fmt"
    	"os"
    
    	"git.lyda.ie/kevin/bulletin/accounts"
    	"git.lyda.ie/kevin/bulletin/repl"
    
    	"github.com/urfave/cli/v3"
    )
    
    func main() {
    	cmd := &cli.Command{
    		Name:        "bulletin",
    		Usage:       "a bulletin system",
    		Description: "An interpretation of the VMS BULLETIN program.",
    		Flags: []cli.Flag{
    			&cli.StringFlag{
    				Name:     "user",
    				Aliases:  []string{"u"},
    				Usage:    "user to run bulletin as",
    				Value:    "",
    				Required: true,
    			},
    		},
    		Action: func(_ context.Context, cmd *cli.Command) error {
    			user := cmd.String("user")
    			err := accounts.Open(user)
    			if err != nil {
    				return err
    			}
    			err = repl.Loop(user)
    			if err != nil {
    				return err
    			}
    			return nil
    		},
    	}
    
    	err := cmd.Run(context.Background(), os.Args)
    	if err != nil {
    		fmt.Println(err)
    	}
    }