diff --git a/README.md b/README.md
index 95a763f..7a7bd49 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@ The CLI Task Manager for Geeks :technologist:
=========
[](https://opensource.org/licenses/MIT)
-[](https://goreportcard.com/report/github.com/ajaxray/geek-life)
+[](https://goreportcard.com/report/github.com/ajaxray/geek-life)
:superhero: Developer / DevOps / Sysadmin? A command line hero?
@@ -19,7 +19,7 @@ Click to see it moving (GIF)
-### :zap: Highlights
+### :crystal_ball: Highlights
- For ninjas - do things faster with keyboard shortcuts
- Markdown lovers, feel at :house:! You'll see markdown everywhere.
@@ -28,7 +28,7 @@ Click to see it moving (GIF)
- Task note editor with markdown syntax highlighting2
- Full mouse support
-### :compass: Roadmap
+### :dart: Roadmap
- [x] Create Project
- [x] Delete Project
- [ ] Edit Project
@@ -50,11 +50,12 @@ Click to see it moving (GIF)
- [ ] [Havitica](https://habitica.com/)3 integration - Use it as Habitica client or use Habitica for cloud backup
- [ ] Time tracking
-### :arrow_down: Ready for action (installing and running)
+### :rocket: Ready for action (installing and running)
It's just a single binary file, **no external dependencies**.
Just download the appropriate version of [executable from latest release](https://github.com/ajaxray/geek-life/releases) for your OS.
-Then rename and give it permission to execute. For example
+Then rename and give it permission to execute.
+For example:
```bash
mv geek-life_linux-amd64 geek-life
sudo chmod +x geek-life
@@ -67,7 +68,7 @@ sudo mv geek-life /usr/local/bin/geek-life
geek-life
```
-Done! Manage your tasks your way!
+Done! *Manage your tasks your way!*
## :keyboard: Keyboard shortcuts
@@ -113,9 +114,9 @@ If you fix a bug or want to add/improve a feature,
and it's aligned with the focus (merging with ease) of this app,
I will be glad to accept your PR. :)
-## :question: You may ask...
+## :bulb: You may ask...
-#### Where is the data stored? Can I change the location?
+#### :question: Where is the data stored? Can I change the location?
By default, it will try to create a db file in you home directory.
@@ -126,7 +127,7 @@ In that case, just mention `DB_FILE` as an environment variable.
DB_FILE=~/dropbox/geek-life/default.db geek-life
```
-#### How can I suggest a feature?
+#### :question: How can I suggest a feature?
Just [post an issue](https://github.com/ajaxray/geek-life/issues/new) describing your desired feature/enhancement
and select `feature` label.
diff --git a/app/cli.go b/app/cli.go
index f2b94e7..87eac02 100644
--- a/app/cli.go
+++ b/app/cli.go
@@ -42,7 +42,7 @@ func main() {
taskRepo = repo.NewTaskRepository(db)
titleText := tview.NewTextView().SetText("[lime::b]Geek-life [::-]- Task Manager for geeks!").SetDynamicColors(true)
- cloudStatus := tview.NewTextView().SetText("[::d]Version: 0.0.1").SetTextAlign(tview.AlignRight).SetDynamicColors(true)
+ cloudStatus := tview.NewTextView().SetText("[::d]Version: 0.0.3").SetTextAlign(tview.AlignRight).SetDynamicColors(true)
titleBar := tview.NewFlex().
AddItem(titleText, 0, 2, false).
diff --git a/app/project_detail.go b/app/project_detail.go
index 4aa50f1..b554509 100644
--- a/app/project_detail.go
+++ b/app/project_detail.go
@@ -25,8 +25,8 @@ func prepareProjectDetail() {
func deleteCurrentProject() {
if currentProject != nil && projectRepo.Delete(currentProject) == nil {
- for i, _ := range tasks {
- taskRepo.Delete(&tasks[i])
+ for i := range tasks {
+ _ = taskRepo.Delete(&tasks[i])
}
showMessage("Removed Project: " + currentProject.Title)
diff --git a/app/projects.go b/app/projects.go
index 6b328f1..42e43cf 100644
--- a/app/projects.go
+++ b/app/projects.go
@@ -17,6 +17,11 @@ func prepareProjectPane() {
SetDoneFunc(func(key tcell.Key) {
switch key {
case tcell.KeyEnter:
+ if len(newProject.GetText()) < 3 {
+ showMessage("[red::]Project name should be at least 3 character")
+ return
+ }
+
project, err := projectRepo.Create(newProject.GetText(), "")
if err != nil {
showMessage("[red::]Failed to create Project:" + err.Error())
diff --git a/app/tasks.go b/app/tasks.go
index 5c551d5..af2e682 100644
--- a/app/tasks.go
+++ b/app/tasks.go
@@ -26,6 +26,11 @@ func prepareTaskPane() {
SetDoneFunc(func(key tcell.Key) {
switch key {
case tcell.KeyEnter:
+ if len(newTask.GetText()) < 3 {
+ showMessage("[red::]Task title should be at least 3 character")
+ return
+ }
+
task, err := taskRepo.Create(*currentProject, newTask.GetText(), "", "", 0)
if err != nil {
showMessage("[red::]Could not create Task:" + err.Error())
diff --git a/app/util.go b/app/util.go
index bac57f9..b96b4b8 100644
--- a/app/util.go
+++ b/app/util.go
@@ -40,9 +40,9 @@ func makeLightTextInput(placeholder string) *tview.InputField {
func parseDateInputOrCurrent(inputText string) time.Time {
if date, err := time.Parse(dateLayoutISO, inputText); err == nil {
return date
- } else {
- return time.Now()
}
+
+ return time.Now()
}
func showMessage(text string) {
diff --git a/model/project.go b/model/project.go
index 52a7606..1d2904b 100644
--- a/model/project.go
+++ b/model/project.go
@@ -1,5 +1,6 @@
package model
+// Project represent a collection of related tasks (tags of Habitica)
type Project struct {
ID int64 `storm:"id,increment",json:"id"`
Title string `storm:"index",json:"title"`
diff --git a/model/task.go b/model/task.go
index aded8a4..3e87064 100644
--- a/model/task.go
+++ b/model/task.go
@@ -1,5 +1,6 @@
package model
+// Task represent a task - the building block of the TaskManager app
type Task struct {
ID int64 `storm:"id,increment",json:"id"`
ProjectID int64 `storm:"index",json:"project_id"`
diff --git a/repository/project.go b/repository/project.go
index 17a60bb..3e28fed 100644
--- a/repository/project.go
+++ b/repository/project.go
@@ -2,6 +2,7 @@ package repository
import "github.com/ajaxray/geek-life/model"
+// ProjectRepository interface defines methods of project data accessor
type ProjectRepository interface {
GetAll() ([]model.Project, error)
GetByID(id int64) (model.Project, error)
diff --git a/repository/task.go b/repository/task.go
index 2f37a0b..fd7f43e 100644
--- a/repository/task.go
+++ b/repository/task.go
@@ -6,6 +6,7 @@ import (
"github.com/ajaxray/geek-life/model"
)
+// TaskRepository interface defines methods of task data accessor
type TaskRepository interface {
GetAll() ([]model.Task, error)
GetAllByProject(project model.Project) ([]model.Task, error)
diff --git a/util/env.go b/util/env.go
index 76af107..5ae8916 100644
--- a/util/env.go
+++ b/util/env.go
@@ -11,6 +11,7 @@ import (
// gotenv.Load()
// }
+// GetEnvInt finds an ENV variable and converts to int, otherwise return default value
func GetEnvInt(key string, defaultVal int) int {
if v, ok := os.LookupEnv(key); ok {
if i, err := strconv.Atoi(v); err == nil {
@@ -25,6 +26,7 @@ func GetEnvInt(key string, defaultVal int) int {
return defaultVal
}
+// GetEnvStr finds an ENV variable, otherwise return default value
func GetEnvStr(key, defaultVal string) string {
if v, ok := os.LookupEnv(key); ok {
return v