Unverified Commit d850e500 authored by Kevin Lyda's avatar Kevin Lyda
Browse files

Some readline cleanup

parent 9a012a54
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,11 +16,14 @@ Look up how godoc does references to other things.

Look up how to run migrations on the db from embedded files.

Figure out readline completion.  Case sensitive - issue?  Building from
repl.commands?

## Things to do

  * Implement a better dclish parser.
  * Implement each command.
    * Next: HELP - move some commands to a Help array.
    * Next: ????
  * Decide on how the boards are managed.

## Module links
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ func Open(acc string) error {
	if err != nil {
		return errors.New("account preference directory problem")
	}
	User.pref, err = sql.Open("sqlite", path.Join(prefdir, acc, ".db"))
	User.pref, err = sql.Open("sqlite", path.Join(prefdir, fmt.Sprintf("%s.%s", acc, ".db")))
	if err != nil {
		return errors.New("account preference database problem")
	}
+5 −5
Original line number Diff line number Diff line
@@ -23,10 +23,10 @@ type Flags map[string]*Flag
// Command contains the definition of a command, it's flags and subcommands.
type Command struct {
	Flags       Flags
	// TODO: FlagOrder []string
	FlagOrder   []string
	Args        []string
	// TODO: MaxArgs int
	// TODO: MinArgs int
	MaxArgs     int
	MinArgs     int
	Commands    []*Command
	Action      ActionFunc
	Description string
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ use is to create a folder for posting SYSTEM messages only meant for a
certain UIC group.  This is done by creating a PRIVATE SYSTEM folder, and
giving access to that UIC group.  Only users in that UIC group will see
the messages in that folder when they log in.`,
	"Ctrl-C": `Except for when BULLETIN is awaiting input from the terminal, a 
	"CTRL-C": `Except for when BULLETIN is awaiting input from the terminal, a 
CTRL-C will cause BULLETIN to abort the execution of any command.  If
BULLETIN is waiting for terminal input, a CTRL-C will cause BULLETIN
to return to the BULLETIN> prompt.  If for some reason the user wishes
+4 −9
Original line number Diff line number Diff line
@@ -2,8 +2,7 @@
package repl

import (
	"fmt"
	"os"
	"errors"

	"git.lyda.ie/kevin/bulletin/accounts"
	"git.lyda.ie/kevin/bulletin/dclish"
@@ -12,17 +11,13 @@ import (
// ActionQuit handles the `QUIT` command.
func ActionQuit(_ *dclish.Command) error {
	accounts.User.Close()
	fmt.Println("QUIT")
	// TODO: IIRC, quit should not update unread data.  Check.
	os.Exit(0)
	return nil
	// TODO: IIRC, quit should not update unread data.  Check old code to confirm.
	return errors.New("QUIT")
}

// ActionExit handles the `EXIT` command.
func ActionExit(_ *dclish.Command) error {
	accounts.User.Close()
	fmt.Println("EXIT")
	// TODO: update unread data.
	os.Exit(0)
	return nil
	return errors.New("EXIT")
}
Loading