9 Commits 6fc15f2734 ... 517c22ba5d

Author SHA1 Message Date
  aeth 517c22ba5d added install and uninstall targets since the go install was being weird 1 month ago
  aeth 585a4b926b ran tidy 1 month ago
  aeth fd0c9a5c9e edited the makefile 1 month ago
  aeth 811ab12c46 more restructure 1 month ago
  aeth ba3eac89e4 more restructure 1 month ago
  aeth f0edd4ff37 more restructure 1 month ago
  aeth 8b2f2654b1 structure stuffs 1 month ago
  aeth de5ac575c8 structure stuffs 1 month ago
  aeth 8fbf4eb5ed minor tweaks 1 month ago
6 changed files with 22 additions and 14 deletions
  1. 7 1
      Makefile
  2. 0 0
      cmd/itashi/banner.txt
  3. 8 2
      cmd/itashi/main.go
  4. 0 1
      go.mod
  5. 0 4
      go.sum
  6. 7 6
      pkg/savestate.go

+ 7 - 1
Makefile

@@ -3,4 +3,10 @@
 
 
 build:
-	go build -o ./build/itashi ./cmd/main.go 
+	go build -o ./build/itashi ./cmd/itashi/main.go 
+
+install:
+	sudo mv ./build/itashi /usr/local/bin/itashi && sudo chmod u+x /usr/local/bin/itashi
+
+uninstall:
+	sudo rm -f /usr/local/bin/itashi

+ 0 - 0
cmd/banner.txt → cmd/itashi/banner.txt


+ 8 - 2
cmd/main.go → cmd/itashi/main.go

@@ -6,6 +6,7 @@ import (
 	"log"
 	"os"
 	"strconv"
+	"strings"
 
 	itashi "git.aetherial.dev/aeth/itashi/pkg"
 	tea "github.com/charmbracelet/bubbletea"
@@ -36,12 +37,17 @@ func main() {
 			shelf.DeleteTask(id)
 			os.Exit(0)
 		case DONE_TASK:
+			var taskName string
 			id, err := strconv.Atoi(args[2])
 			if err != nil {
 				log.Fatal("ID passed was not a valid integer: ", err)
 			}
-			shelf.MarkDone(id)
-			fmt.Print("よくできた! Good job!\n")
+			taskName = shelf.MarkDone(id)
+			if taskName == "" {
+				fmt.Printf("No task was indexed with ID: %v\n", id)
+				os.Exit(0)
+			}
+			fmt.Printf("よくできた! Good job! Task '%s' was marked complete!\n", strings.TrimSuffix(taskName, "\n"))
 			os.Exit(0)
 		case TIDY_TASK:
 			fmt.Printf("Shelf tidied, removed %v completed tasks.\n", shelf.Clean())

+ 0 - 1
go.mod

@@ -16,7 +16,6 @@ require (
 	github.com/muesli/reflow v0.3.0 // indirect
 	github.com/muesli/termenv v0.15.2 // indirect
 	github.com/rivo/uniseg v0.4.6 // indirect
-	golang.org/x/crypto v0.23.0 // indirect
 	golang.org/x/sync v0.7.0 // indirect
 	golang.org/x/sys v0.20.0 // indirect
 	golang.org/x/term v0.20.0 // indirect

+ 0 - 4
go.sum

@@ -25,8 +25,6 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ
 github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
 github.com/rivo/uniseg v0.4.6 h1:Sovz9sDSwbOz9tgUy8JpT+KgCkPYJEN/oYzlJiYTNLg=
 github.com/rivo/uniseg v0.4.6/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
-golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
-golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
 golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
 golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
 golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -35,7 +33,5 @@ golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
 golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
 golang.org/x/term v0.20.0 h1:VnkxpohqXaOBYJtBmEppKUG6mXpi+4O6purfc2+sMhw=
 golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
-golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
-golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
 golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
 golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=

+ 7 - 6
pkg/savestate.go

@@ -58,7 +58,7 @@ type TaskShelf interface {
 	// delete an existing task from the shelf
 	DeleteTask(id int)
 	// Mark a task as complete
-	MarkDone(id int)
+	MarkDone(id int) string
 	// hopefully you dont need to call this! ;)
 	ResetDone(id int)
 	// Add a task to the shelf
@@ -219,25 +219,26 @@ and write it, as opposed to just modifying the pointer and then writing.
 	    :param id: the ID of the task to mark as done
 		:returns: Nothing
 */
-func (f *FilesystemShelf) MarkDone(id int) {
+func (f *FilesystemShelf) MarkDone(id int) string {
 	replTasks := []Task{}
+	var taskName string
 	for i := range f.Tasks {
 		if f.Tasks[i].Id == id {
-			doneTask := Task{
+			replTasks = append(replTasks, Task{
 				Id:       f.Tasks[i].Id,
 				Title:    f.Tasks[i].Title,
 				Desc:     f.Tasks[i].Desc,
 				Due:      f.Tasks[i].Due,
 				Done:     true,
 				Priority: f.Tasks[i].Priority,
-			}
-			replTasks = append(replTasks, doneTask)
+			})
+			taskName = f.Tasks[i].Title
 			continue
 		}
 		replTasks = append(replTasks, f.Tasks[i])
 	}
 	os.WriteFile(f.SaveLocation, marshalTaskToShelf(replTasks, f.Template), os.ModePerm)
-
+	return taskName
 }
 
 func (f *FilesystemShelf) ResetDone(id int) {}