idk some stuff
This commit is contained in:
parent
a946a56dea
commit
ca39db02b3
33
README
Normal file
33
README
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
= poms =
|
||||||
|
|
||||||
|
A very opinionated companion for taskwarrior, with notes and the pomodoro technique.
|
||||||
|
Designed to help you overcome being overwhelmed
|
||||||
|
|
||||||
|
= workflow =
|
||||||
|
|
||||||
|
- You pick a list of tasks you think you can achieve in the time you have alotted.
|
||||||
|
- A good reference for this is [cblgh's 12pom days](https://cblgh.org/12%20pomodoro%20workday/)
|
||||||
|
- Each of the tasks you list get placed into a text file.
|
||||||
|
- This textfile is free to use as you see fit.
|
||||||
|
- I make plan textfiles, and I generally link my task-note into that, and write about the specific task in there.
|
||||||
|
- Once you feel like you've got an adequate plan for each of your tasks, you can exit your editor.
|
||||||
|
- You'll get to choose which task to work on next
|
||||||
|
- Now you're in Pomodoro mode. Do the task! Take more notes with a shortcut.
|
||||||
|
- Now it's break time!
|
||||||
|
- Rinse, repeat until you're done!
|
||||||
|
|
||||||
|
= Roadmap / Issues =
|
||||||
|
|
||||||
|
- Implement state machine to manage state (See design docs)
|
||||||
|
- Implement timer
|
||||||
|
- It should have big full screen countdown MM:SS
|
||||||
|
- Ideally the individual digits are ascii art made from the digit itself
|
||||||
|
- TaskList Active tasks should _always_ display, and then let the cursor indexing kick in
|
||||||
|
- Dynamic column spacing based on WindowResizeMsg
|
||||||
|
- When going from TaskList to nvim, don't overwrite! Ask!
|
||||||
|
- Show hints about actions / shortcuts on screen
|
||||||
|
- Refactor extra functions out of `main.go` and into `task.go`
|
||||||
|
- Make sure task loading happens through `tea.Cmd`
|
||||||
|
|
||||||
|
= Design Docs =
|
||||||
|
- [Excalidraw drawings](https://excalidraw.com/#json=Tucrdp__TOwmtOEvNnbVv,ep_J-9-vB3BRVjnd0Y2H0w)
|
3421
docs/poms.excalidraw
Normal file
3421
docs/poms.excalidraw
Normal file
File diff suppressed because it is too large
Load diff
34
main.go
34
main.go
|
@ -19,9 +19,9 @@ var (
|
||||||
tasks = task.GetTasks()
|
tasks = task.GetTasks()
|
||||||
columns = []table.Column{
|
columns = []table.Column{
|
||||||
{Title: "ID", Width: 4},
|
{Title: "ID", Width: 4},
|
||||||
{Title: "Project", Width: 10},
|
{Title: "Project", Width: 20},
|
||||||
{Title: "Tags", Width: 10},
|
{Title: "Tags", Width: 40},
|
||||||
{Title: "Description", Width: 20},
|
{Title: "Description", Width: 95},
|
||||||
// {Title: "Urgency", Width: 10},
|
// {Title: "Urgency", Width: 10},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
type model struct {
|
type model struct {
|
||||||
all table.Model
|
state string
|
||||||
|
taskList table.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func TasksToRows(tasks []task.Task) []table.Row {
|
func TasksToRows(tasks []task.Task) []table.Row {
|
||||||
|
@ -74,8 +75,8 @@ type editorFinishedMsg struct{ err error }
|
||||||
|
|
||||||
func (m model) rowsToFile() []string {
|
func (m model) rowsToFile() []string {
|
||||||
var rows []string
|
var rows []string
|
||||||
for index, row := range m.all.Rows() {
|
for index, row := range m.taskList.Rows() {
|
||||||
if index < m.all.ActiveIndex() {
|
if index < m.taskList.ActiveIndex() {
|
||||||
// get uuid
|
// get uuid
|
||||||
id := row[0]
|
id := row[0]
|
||||||
uuid_byte, err := exec.Command("task", "_get", id + ".uuid").Output()
|
uuid_byte, err := exec.Command("task", "_get", id + ".uuid").Output()
|
||||||
|
@ -123,10 +124,10 @@ func (m model) writeFile() string {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
fmt.Println(f, "%title ")
|
fmt.Fprintln(f, "%title ")
|
||||||
fmt.Println(f, ":pom:priv:plan:")
|
fmt.Fprintln(f, ":pom:priv:plan:")
|
||||||
fmt.Println(f, "%date " + path)
|
fmt.Fprintln(f, "%date " + path)
|
||||||
fmt.Println(f, "")
|
fmt.Fprintln(f, "")
|
||||||
|
|
||||||
rows := m.rowsToFile()
|
rows := m.rowsToFile()
|
||||||
for _, value := range rows {
|
for _, value := range rows {
|
||||||
|
@ -159,18 +160,23 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
case "enter":
|
case "enter":
|
||||||
return m, m.openEditor()
|
return m, m.openEditor()
|
||||||
}
|
}
|
||||||
|
case tea.WindowSizeMsg:
|
||||||
|
//top, right, bottom, left := baseStyle.GetMargin()
|
||||||
|
m.taskList.SetWidth(msg.Width - 5)
|
||||||
|
m.taskList.SetHeight(msg.Height - 5)
|
||||||
}
|
}
|
||||||
m.all, cmd = m.all.Update(msg)
|
m.taskList, cmd = m.taskList.Update(msg)
|
||||||
return m, cmd
|
return m, cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m model) View() string {
|
func (m model) View() string {
|
||||||
return baseStyle.Render(m.all.View())
|
return baseStyle.Render(m.taskList.View())
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
m := model{CreateTable()}
|
var m model
|
||||||
if _, err := tea.NewProgram(m, tea.WithAltScreen()).Run(); err != nil {
|
m.taskList = CreateTable()
|
||||||
|
if _, err := tea.NewProgram(m).Run(); err != nil {
|
||||||
fmt.Println("Error running program:", err)
|
fmt.Println("Error running program:", err)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ type Model struct {
|
||||||
|
|
||||||
viewport viewport.Model
|
viewport viewport.Model
|
||||||
start int
|
start int
|
||||||
selected int
|
activeIndex int
|
||||||
end int
|
end int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ type Option func(*Model)
|
||||||
func New(opts ...Option) Model {
|
func New(opts ...Option) Model {
|
||||||
m := Model{
|
m := Model{
|
||||||
cursor: 0,
|
cursor: 0,
|
||||||
selected: 0,
|
activeIndex: 0,
|
||||||
viewport: viewport.New(0, 20),
|
viewport: viewport.New(0, 20),
|
||||||
|
|
||||||
KeyMap: DefaultKeyMap(),
|
KeyMap: DefaultKeyMap(),
|
||||||
|
@ -335,17 +335,17 @@ func (m *Model) SwitchRow() {
|
||||||
// If cursor outside selection (adding selection)
|
// If cursor outside selection (adding selection)
|
||||||
// We check equals because if it's on the border, we just moved into selection
|
// We check equals because if it's on the border, we just moved into selection
|
||||||
// and are still adding
|
// and are still adding
|
||||||
if m.cursor >= m.selected {
|
if m.cursor >= m.activeIndex {
|
||||||
newSelection := make([]Row, len(removedRows) + 1)
|
newSelection := make([]Row, len(removedRows) + 1)
|
||||||
newSelection = append(removedRows[:m.selected+1], removedRows[m.selected:]...)
|
newSelection = append(removedRows[:m.activeIndex+1], removedRows[m.activeIndex:]...)
|
||||||
newSelection[m.selected] = selectedRow
|
newSelection[m.activeIndex] = selectedRow
|
||||||
m.rows = newSelection
|
m.rows = newSelection
|
||||||
m.selected += 1
|
m.activeIndex += 1
|
||||||
} else {
|
} else {
|
||||||
m.selected -= 1
|
m.activeIndex -= 1
|
||||||
newSelection := make([]Row, len(removedRows) + 1)
|
newSelection := make([]Row, len(removedRows) + 1)
|
||||||
newSelection = append(removedRows[:m.selected+1], removedRows[m.selected:]...)
|
newSelection = append(removedRows[:m.activeIndex+1], removedRows[m.activeIndex:]...)
|
||||||
newSelection[m.selected] = selectedRow
|
newSelection[m.activeIndex] = selectedRow
|
||||||
m.rows = newSelection
|
m.rows = newSelection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ func (m *Model) SetHeight(h int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) ActiveIndex() int {
|
func (m *Model) ActiveIndex() int {
|
||||||
return m.selected
|
return m.activeIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
// Height returns the viewport height of the table.
|
// Height returns the viewport height of the table.
|
||||||
|
@ -474,7 +474,7 @@ func (m *Model) renderRow(r int) string {
|
||||||
cellStyle = m.styleFunc(r, i, value)
|
cellStyle = m.styleFunc(r, i, value)
|
||||||
if r == m.cursor {
|
if r == m.cursor {
|
||||||
cellStyle.Inherit(m.styles.Selected)
|
cellStyle.Inherit(m.styles.Selected)
|
||||||
} else if r < m.selected {
|
} else if r < m.activeIndex {
|
||||||
cellStyle.Inherit(m.styles.Active)
|
cellStyle.Inherit(m.styles.Active)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -491,7 +491,7 @@ func (m *Model) renderRow(r int) string {
|
||||||
if r == m.cursor {
|
if r == m.cursor {
|
||||||
return m.styles.Selected.Render(row)
|
return m.styles.Selected.Render(row)
|
||||||
}
|
}
|
||||||
if r < m.selected {
|
if r < m.activeIndex {
|
||||||
return m.styles.Active.Render(row)
|
return m.styles.Active.Render(row)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue