Select Git revision
PACKAGING.md
set.go 4.90 KiB
// Package repl implements the main event loop.
package repl
import (
"errors"
"fmt"
"strings"
"git.lyda.ie/kevin/bulletin/dclish"
"git.lyda.ie/kevin/bulletin/folders"
"git.lyda.ie/kevin/bulletin/this"
)
// ActionSetAccess handles the `SET ACCESS` command.
func ActionSetAccess(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetAccess.")
return nil
}
// ActionSetAlways handles the `SET ALWAYS` command.
func ActionSetAlways(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetAlways.")
return nil
}
// ActionSetNoalways handles the `SET NOALWAYS` command.
func ActionSetNoalways(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetNoalways.")
return nil
}
// ActionSetBrief handles the `SET BRIEF` command.
func ActionSetBrief(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetBrief.")
return nil
}
// ActionSetNobrief handles the `SET NOBRIEF` command.
func ActionSetNobrief(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetNobrief.")
return nil
}
// ActionSetDefaultExpire handles the `SET DEFAULT_EXPIRE` command.
func ActionSetDefaultExpire(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetDefaultExpire.")
return nil
}
// ActionSetExpireLimit handles the `SET EXPIRE_LIMIT` command.
func ActionSetExpireLimit(_ *dclish.Command) error {
fmt.Println("TODO: implement ActionSetExpireLimit.")
return nil
}
// ActionSetFolder handles the `SET FOLDER` command. This selects a folder.
func ActionSetFolder(cmd *dclish.Command) error {
if len(cmd.Args) != 1 {
return errors.New("TODO: need to add code for /MARK")
}
// TODO: Move shared code here and in ActionSelect and ActionDirectory into a function.
if strings.Contains(cmd.Args[0], "%") {
return errors.New("Folder name cannot contain a %")
}
folder := folders.FindFolder(cmd.Args[0])
if folder.Name == "" {
return errors.New("Unable to select the folder")
}
if folders.IsFolderAccess(folder.Name, this.User.Login) {
this.Folder = folder