Skip to content
Snippets Groups Projects
Unverified Commit cf1f64af authored by Kevin Lyda's avatar Kevin Lyda
Browse files

Initial go setup.

parent 9ff08110
No related branches found
No related tags found
No related merge requests found
// Package accounts manages accounts.
package accounts
import "errors"
// Verify verifies that an account exists.
func Verify(acc string) error {
if acc == "" {
return errors.New("Empty account is invalid")
}
return nil
}
go.mod 0 → 100644
module git.lyda.ie/kevin/bulletin
go 1.24.2
require github.com/urfave/cli/v3 v3.3.2 // indirect
main.go 0 → 100644
// 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"
"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.Verify(user)
if err != nil {
return err
}
fmt.Println("Running as", user)
return nil
},
}
err := cmd.Run(context.Background(), os.Args)
if err != nil {
fmt.Println(err)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment