WIP: UI improvements and code refactoring #2

Closed
dananglin wants to merge 25 commits from ui-overhall into main
11 changed files with 28 additions and 28 deletions
Showing only changes of commit c43d8889df - Show all commits

2
.gitignore vendored
View file

@ -1,2 +1,2 @@
/test/databases/*.db
/pelican
/canal

View file

@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Pelican
Canal
Copyright (C) 2021 Dan Anglin
This program is free software: you can redistribute it and/or modify
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
Pelican Copyright (C) 2021 Dan Anglin
Canal Copyright (C) 2021 Dan Anglin
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.

View file

@ -1,15 +1,15 @@
# Pelican
# Canal
## Summary
Pelican is a simple Kanban board for your terminal.
Canal is a simple Kanban board for your terminal.
## Storage
Data is stored in a [BoltDB](https://github.com/etcd-io/bbolt) database.
For Linux the default the database file is located at $XDG\_DATA\_HOME/pelican/pelican.db
If $XDG\_DATA\_HOME is not set then the default location is $HOME/.local/share/pelican/pelican.db by default.
For all other operating systems the default location is $HOME/.pelican/pelican.db.
For Linux the default the database file is located at $XDG\_DATA\_HOME/canal/canal.db
If $XDG\_DATA\_HOME is not set then the default location is $HOME/.local/share/canal/canal.db by default.
For all other operating systems the default location is $HOME/.canal/canal.db.
## Keybindings

View file

@ -3,7 +3,7 @@ package main
import (
"fmt"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/ui"
"forge.dananglin.me.uk/code/dananglin/canal/internal/ui"
)
func main() {

2
go.mod
View file

@ -1,4 +1,4 @@
module forge.dananglin.me.uk/code/dananglin/pelican
module forge.dananglin.me.uk/code/dananglin/canal
go 1.16

View file

@ -6,7 +6,7 @@ import (
"fmt"
"sort"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/database"
"forge.dananglin.me.uk/code/dananglin/canal/internal/database"
bolt "go.etcd.io/bbolt"
)

View file

@ -7,7 +7,7 @@ import (
"reflect"
"testing"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/board"
"forge.dananglin.me.uk/code/dananglin/canal/internal/board"
bolt "go.etcd.io/bbolt"
)

View file

@ -192,9 +192,9 @@ func Read(db *bolt.DB, bucketName string, id int) ([]byte, error) {
}
// dbPath returns the path to the database file. If a path is given then that is returned. Otherwise the default path is returned.
// For linux, the default location of the database file is $XDG_DATA_HOME/pelican/pelican.db. If the XDG_DATA_HOME environment
// variable is not set then it will default to $HOME/.local/share/pelican/pelican.db. For all other operating systems the default
// location is $HOME/.pelican/pelican.db.
// For linux, the default location of the database file is $XDG_DATA_HOME/canal/canal.db. If the XDG_DATA_HOME environment
// variable is not set then it will default to $HOME/.local/share/canal/canal.db. For all other operating systems the default
// location is $HOME/.canal/canal.db.
func dbPath(path string) string {
if len(path) > 0 {
filepath.Dir(path)
@ -202,7 +202,7 @@ func dbPath(path string) string {
return path
}
dbFilename := "pelican.db"
dbFilename := "canal.db"
var dataDir string
@ -215,9 +215,9 @@ func dbPath(path string) string {
dataHome = filepath.Join(os.Getenv("HOME"), ".local", "share")
}
dataDir = filepath.Join(dataHome, "pelican")
dataDir = filepath.Join(dataHome, "canal")
default:
dataDir = filepath.Join(os.Getenv("HOME"), ".pelican")
dataDir = filepath.Join(os.Getenv("HOME"), ".canal")
}
path = filepath.Join(dataDir, dbFilename)

View file

@ -9,8 +9,8 @@ import (
"reflect"
"testing"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/board"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/database"
"forge.dananglin.me.uk/code/dananglin/canal/internal/board"
"forge.dananglin.me.uk/code/dananglin/canal/internal/database"
bolt "go.etcd.io/bbolt"
)
@ -40,7 +40,7 @@ func TestOpenDataBaseXDGDataDir(t *testing.T) {
_ = db.Close()
wantDB := filepath.Join(testXdgDataHome, "pelican", "pelican.db")
wantDB := filepath.Join(testXdgDataHome, "canal", "canal.db")
// ensure that the database file exists
_, err = os.Stat(wantDB)

View file

@ -4,7 +4,7 @@ package ui
import (
"fmt"
"forge.dananglin.me.uk/code/dananglin/pelican/internal/board"
"forge.dananglin.me.uk/code/dananglin/canal/internal/board"
"github.com/eiannone/keyboard"
bolt "go.etcd.io/bbolt"
)

View file

@ -11,24 +11,24 @@ import (
)
const (
binary = "pelican"
binary = "canal"
)
var Default = Build
// Test run the go tests
// To enable verbose mode set PELICAN_TEST_VERBOSE=1.
// To enable coverage mode set PELICAN_TEST_COVER=1.
// To enable verbose mode set CANAL_TEST_VERBOSE=1.
// To enable coverage mode set CANAL_TEST_COVER=1.
func Test() error {
goTest := sh.RunCmd("go", "test")
args := []string{"./..."}
if os.Getenv("PELICAN_TEST_VERBOSE") == "1" {
if os.Getenv("CANAL_TEST_VERBOSE") == "1" {
args = append(args, "-v")
}
if os.Getenv("PELICAN_TEST_COVER") == "1" {
if os.Getenv("CANAL_TEST_COVER") == "1" {
args = append(args, "-cover")
}
@ -42,7 +42,7 @@ func Lint() error {
// Build build the executable
func Build() error {
main := "./cmd/pelican/main.go"
main := "./cmd/canal/main.go"
return sh.Run("go", "build", "-o", binary, main)
}