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
40
main.go
40
main.go
|
@ -19,9 +19,9 @@ var (
|
|||
tasks = task.GetTasks()
|
||||
columns = []table.Column{
|
||||
{Title: "ID", Width: 4},
|
||||
{Title: "Project", Width: 10},
|
||||
{Title: "Tags", Width: 10},
|
||||
{Title: "Description", Width: 20},
|
||||
{Title: "Project", Width: 20},
|
||||
{Title: "Tags", Width: 40},
|
||||
{Title: "Description", Width: 95},
|
||||
// {Title: "Urgency", Width: 10},
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,8 @@ var (
|
|||
)
|
||||
|
||||
type model struct {
|
||||
all table.Model
|
||||
state string
|
||||
taskList table.Model
|
||||
}
|
||||
|
||||
func TasksToRows(tasks []task.Task) []table.Row {
|
||||
|
@ -74,8 +75,8 @@ type editorFinishedMsg struct{ err error }
|
|||
|
||||
func (m model) rowsToFile() []string {
|
||||
var rows []string
|
||||
for index, row := range m.all.Rows() {
|
||||
if index < m.all.ActiveIndex() {
|
||||
for index, row := range m.taskList.Rows() {
|
||||
if index < m.taskList.ActiveIndex() {
|
||||
// get uuid
|
||||
id := row[0]
|
||||
uuid_byte, err := exec.Command("task", "_get", id + ".uuid").Output()
|
||||
|
@ -123,15 +124,15 @@ func (m model) writeFile() string {
|
|||
log.Fatal(err)
|
||||
}
|
||||
defer f.Close()
|
||||
fmt.Println(f, "%title ")
|
||||
fmt.Println(f, ":pom:priv:plan:")
|
||||
fmt.Println(f, "%date " + path)
|
||||
fmt.Println(f, "")
|
||||
fmt.Fprintln(f, "%title ")
|
||||
fmt.Fprintln(f, ":pom:priv:plan:")
|
||||
fmt.Fprintln(f, "%date " + path)
|
||||
fmt.Fprintln(f, "")
|
||||
|
||||
rows := m.rowsToFile()
|
||||
for _, value := range rows {
|
||||
fmt.Fprintln(f, value) // print values to f, one per line
|
||||
}
|
||||
for _, value := range rows {
|
||||
fmt.Fprintln(f, value) // print values to f, one per line
|
||||
}
|
||||
return full_path
|
||||
}
|
||||
|
||||
|
@ -159,18 +160,23 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
case "enter":
|
||||
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
|
||||
}
|
||||
|
||||
func (m model) View() string {
|
||||
return baseStyle.Render(m.all.View())
|
||||
return baseStyle.Render(m.taskList.View())
|
||||
}
|
||||
|
||||
func main() {
|
||||
m := model{CreateTable()}
|
||||
if _, err := tea.NewProgram(m, tea.WithAltScreen()).Run(); err != nil {
|
||||
var m model
|
||||
m.taskList = CreateTable()
|
||||
if _, err := tea.NewProgram(m).Run(); err != nil {
|
||||
fmt.Println("Error running program:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ type Model struct {
|
|||
|
||||
viewport viewport.Model
|
||||
start int
|
||||
selected int
|
||||
activeIndex int
|
||||
end int
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ type Option func(*Model)
|
|||
func New(opts ...Option) Model {
|
||||
m := Model{
|
||||
cursor: 0,
|
||||
selected: 0,
|
||||
activeIndex: 0,
|
||||
viewport: viewport.New(0, 20),
|
||||
|
||||
KeyMap: DefaultKeyMap(),
|
||||
|
@ -335,17 +335,17 @@ func (m *Model) SwitchRow() {
|
|||
// If cursor outside selection (adding selection)
|
||||
// We check equals because if it's on the border, we just moved into selection
|
||||
// and are still adding
|
||||
if m.cursor >= m.selected {
|
||||
if m.cursor >= m.activeIndex {
|
||||
newSelection := make([]Row, len(removedRows) + 1)
|
||||
newSelection = append(removedRows[:m.selected+1], removedRows[m.selected:]...)
|
||||
newSelection[m.selected] = selectedRow
|
||||
newSelection = append(removedRows[:m.activeIndex+1], removedRows[m.activeIndex:]...)
|
||||
newSelection[m.activeIndex] = selectedRow
|
||||
m.rows = newSelection
|
||||
m.selected += 1
|
||||
m.activeIndex += 1
|
||||
} else {
|
||||
m.selected -= 1
|
||||
m.activeIndex -= 1
|
||||
newSelection := make([]Row, len(removedRows) + 1)
|
||||
newSelection = append(removedRows[:m.selected+1], removedRows[m.selected:]...)
|
||||
newSelection[m.selected] = selectedRow
|
||||
newSelection = append(removedRows[:m.activeIndex+1], removedRows[m.activeIndex:]...)
|
||||
newSelection[m.activeIndex] = selectedRow
|
||||
m.rows = newSelection
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ func (m *Model) SetHeight(h int) {
|
|||
}
|
||||
|
||||
func (m *Model) ActiveIndex() int {
|
||||
return m.selected
|
||||
return m.activeIndex
|
||||
}
|
||||
|
||||
// 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)
|
||||
if r == m.cursor {
|
||||
cellStyle.Inherit(m.styles.Selected)
|
||||
} else if r < m.selected {
|
||||
} else if r < m.activeIndex {
|
||||
cellStyle.Inherit(m.styles.Active)
|
||||
}
|
||||
} else {
|
||||
|
@ -491,7 +491,7 @@ func (m *Model) renderRow(r int) string {
|
|||
if r == m.cursor {
|
||||
return m.styles.Selected.Render(row)
|
||||
}
|
||||
if r < m.selected {
|
||||
if r < m.activeIndex {
|
||||
return m.styles.Active.Render(row)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue