Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Aug 6, 2019
2 parents dc3d98b + 8ed4aa1 commit dfbdbc9
Show file tree
Hide file tree
Showing 37 changed files with 525 additions and 295 deletions.
2 changes: 1 addition & 1 deletion .bin/analytics
Original file line number Diff line number Diff line change
@@ -1 +1 @@
curl -s https://formulae.brew.sh/analytics/install/30d/ | grep taskell -A 1 | sed -e 's/<[^>]*>//g'
brew info taskell | tail -3
2 changes: 1 addition & 1 deletion .bin/tests
Original file line number Diff line number Diff line change
@@ -1 +1 @@
stack test --test-arguments --hide-successes
stack test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ large.md
.stack-work-profile/
releases/
homebrew-taskell/
.cmt.bkp
47 changes: 5 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,48 +251,7 @@ subtask = "-"

You can edit keyboard bindings in the `bindings.ini` config file.

The default bindings are as follows:

```ini
# general
quit = q
undo = u
search = /
help = ?

# navigation
previous = k
next = j
left = h
right = l
bottom = G

# new tasks
new = a
newAbove = O
newBelow = o

# editing tasks
edit = e, A, i
clear = C
delete = D
detail = <Enter>
dueDate = @

# moving tasks
moveUp = K
moveDown = J
moveLeft = H
moveRight = L, <Space>
moveMenu = m

# lists
listNew = N
listEdit = E
listDelete = X
listRight = >
listLeft = <
```
The default bindings can be found in [`bindings.ini`](https://github.com/smallhadroncollider/taskell/blob/master/templates/bindings.ini).

Available special keys: `<Space>`, `<Enter>`, `<Backspace>`, `<Left>`, `<Right>`, `<Up>`, `<Down>`

Expand All @@ -311,6 +270,10 @@ You can edit Taskell's colour-scheme by editing `theme.ini`:
; list title
title.fg = green

; status bar
statusBar.bg = magenta
statusBar.fg = black

; current list title
titleCurrent.fg = blue

Expand Down
6 changes: 3 additions & 3 deletions docs/html/_config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Setup
title: taskell
tagline: Command-line Kanban board/task managment
tagline: Command-line Kanban board/task management
baseurl: ""
locale: "en"
version: 1.4.3
version: 1.5.0
destination: _site/public
exclude: [deployment, Capfile, log, Gemfile, Gemfile.lock]

Expand All @@ -16,4 +16,4 @@ author:
markdown: kramdown

kramdown:
parse_block_html: true
parse_block_html: true
2 changes: 2 additions & 0 deletions docs/html/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ listLeft = <

Available special keys: `<Space>`, `<Enter>`, `<Backspace>`, `<Left>`, `<Right>`, `<Up>`, `<Down>`

On a Mac you can use the `alt` characters: e.g. `quit = œ` is equivalent to `alt+q`.

You shouldn't try to assign the `1`-`9` keys, as it will not overwrite the default behaviour.


Expand Down
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: taskell
version: '1.4.3.0'
version: '1.5.0.0'
category: Command Line Tools
author: Mark Wales
maintainer: mark@smallhadroncollider.com
Expand Down
60 changes: 37 additions & 23 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
> Update taskell.app to have more than just README.md contents. Use cases, more images, examples, etc.
* [ ] Use case example: checklist
* [ ] Use case example: Git controlled tasks
* [ ] Blog posts for updates

## Refactoring

- Use Attoparsec for parsing
- Switch over to Vectors?
> Sequence has O(log n) lookup. Vector has O(1). Vectors support mapping with index.
- Add tests for IO.GitHub
- Break up State module
- Parse checkItems Trello JSON using Aeson FromJSON rather than needing extra record type
- Use a map in Actions to tidy things up/add custom key support
- Avoid having to normalise the state?
- Remove duplication of config - currently using ini and hard-coded defaults
- Move Help modal creation into Template Haskell
- Tidy up load functions in IO.Taskell
- Remove `~` style sub-task complete parsing
@ 2018-12-10
- Use Shake instead of bash script
Expand All @@ -23,9 +24,9 @@

- Very long words should get hyphenated
> The cursor gets lost if a word is longer than the line - URLs in particular can cause issues
- No longer a difference between <Space> and move right
- Help modal needs to wrap and scroll
- Modal boxes shouldn't be full height unless they need to be
- Up and down in search gets a bit lost
- Limit modal height based on content
- Multiple spaces in a line don't show up as more than one, but are saved as more than one
- Task description should be visible by default in task detail
> Visibility should be on the description by default?
Expand All @@ -38,6 +39,12 @@

## Features

- Some way to just see tasks with due dates
* [ ] Sort by date or filter by urgency?
- Add a List widget for common actions between tasks and sub-tasks
* [ ] Re-ordering subtasks
- Duplicate task with `+`
- Add tags/labels with `t`
- Use proper error codes
- Performance with large files
> Becomes unusable with large files
Expand All @@ -46,51 +53,48 @@
* [ ] Invalidate layout cache less frequently
* [ ] Benchmarking tests
* [ ] Allow cancelling write to avoid trying to write the same file at the same time
- Inifinite task depth?
> No reason, other than UX, that sub-tasks can't have sub-tasks.
- Should be able to have new-lines in task descriptions
* [x] Trello import
* [ ] Regular input (Shift + Enter for new line?)
* [x] Markdown parsing
* [ ] Text line breaks go a bit funny with multi-line descriptions
- Check times work no matter what timezone
- Show filename somewhere
- Add tags/labels with `t`
- URL field - plus config to run specific command when selected (e.g. `open -a Chrome.app #{url}`)
- Redo functionality
- Always show list title
> Floating list titles - so you can always see what list you're in
- Make token UX better
* [ ] Open link automatically?
* [ ] Ask for token and save to ini file automatically
- Reordering sub-tasks
- Add Trello syncing
- Item count for lists?
> Show the numbers of items in a list next to its title
- Always show list title
> Floating list titles - so you can always see what list you're in
- Duplicate task with `+`
- Some way to just see tasks with due dates
* [ ] Sort by date or filter by urgency?
- Ability to load a taskell file with custom config.ini settings
> Either command line arguments for settings or just a `-c other.ini` command
- Import Issues from GitHub using labels
- Readline support?
> Using Haskline: https://rootmos.github.io/main/2017/08/31/combining-brick-and-haskeline.html
- Editable title?
> Use a `# Title` at top of file and display title somewhere in taskell
- Keep undo between sessions?
- Ability to load a taskell file with custom config.ini settings
> Either command line arguments for settings or just a `-c other.ini` command
- Inifinite task depth?
> No reason, other than UX, that sub-tasks can't have sub-tasks.
- Add Trello syncing

## In Progress

- Search navigation issues
> Issues with navigation when in NORMAL + SEARCH mode
* [x] Navigating up and down
* [x] Navigating between lists
* [ ] Moving task up and down
* [x] Often nothing is selected when first entering search mode
- Add custom key support
* [x] Create bindings.ini
* [x] Update events to use Map from bindings.ini
* [ ] Check for key conflicts: include keys not explicitly mapped (e.g. 1-9, Esc, Enter)
* [x] Check for bits of functionality missing a mapping
* [x] Update Help dialogue with key mappings
* [ ] Needs to support merging with default options so that it's easy to add new default keys in the future
* [x] Needs to support merging with default options so that it's easy to add new default keys in the future
* [ ] Add keys to Help which aren't in bindings
* [ ] Check for duplicate keys
* [ ] More detailed error messages for missing/invalid mappings
- Add a List widget for common actions between tasks and sub-tasks

## Done

Expand Down Expand Up @@ -268,3 +272,13 @@
- Automate website publishing when doing a new build
> Should automatically update the `_config.yml` file, build the website, then deploy it
- Can't remove a description
- Title bar for extra info
* [x] File path
* [x] Current position
- Search should be case insensitive
- Add Mode to status bar
- Modals interfere with status bar
- Showing a specific task in search mode shows wrong task
> Based on the index in the full list, rather than the filtered one. So will show the task from the full list if the indexes don't happen to match.
- Can't remove dates
- Tidy up load functions in IO.Taskell
24 changes: 16 additions & 8 deletions src/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ import ClassyPrelude
import Control.Lens ((^.))

import Brick
import Graphics.Vty (Mode (BracketedPaste), outputIface, setMode, supportsMode)
import Graphics.Vty (Mode (BracketedPaste), displayBounds, outputIface, setMode,
supportsMode)
import Graphics.Vty.Input.Events (Event (..))

import qualified Control.FoldDebounce as Debounce

import Data.Taskell.Date (currentDay)
import Data.Taskell.Lists (Lists)
import Events.Actions (ActionSets, event, generateActions)
import Events.State (continue, countCurrent)
import Events.State.Types (State, current, io, lists, mode, path)
import Events.State (continue, countCurrent, setHeight)
import Events.State.Types (State, current, io, lists, mode, path, searchTerm)
import Events.State.Types.Mode (InsertMode (..), InsertType (..), ModalType (..), Mode (..))
import IO.Config (Config, generateAttrMap, getBindings, layout)
import IO.Taskell (writeData)
Expand Down Expand Up @@ -85,8 +86,8 @@ handleVtyEvent ::
(DebouncedWrite, Trigger) -> ActionSets -> State -> Event -> EventM ResourceName (Next State)
handleVtyEvent (send, trigger) actions previousState e = do
let state = event actions e previousState
when (previousState ^. searchTerm /= state ^. searchTerm) invalidateCache
case previousState ^. mode of
Search _ _ -> invalidateCache
(Modal MoveTo) -> clearAllTitles previousState
(Insert ITask ICreate _) -> clearList previousState
_ -> pure ()
Expand All @@ -96,23 +97,30 @@ handleVtyEvent (send, trigger) actions previousState e = do
(Insert ITask ICreate _) -> clearList state *> next send state
_ -> clearCache previousState *> clearCache state *> next send state

getHeight :: EventM ResourceName Int
getHeight = snd <$> (displayBounds =<< outputIface <$> getVtyHandle)

handleEvent ::
(DebouncedWrite, Trigger)
-> ActionSets
-> State
-> BrickEvent ResourceName e
-> EventM ResourceName (Next State)
handleEvent _ _ state (VtyEvent (EvResize _ _)) = invalidateCache *> Brick.continue state
handleEvent db actions state (VtyEvent ev) = handleVtyEvent db actions state ev
handleEvent _ _ state _ = Brick.continue state
handleEvent _ _ state (VtyEvent (EvResize _ _)) = do
invalidateCache
h <- getHeight
Brick.continue (setHeight h state)
handleEvent db actions state (VtyEvent ev) = handleVtyEvent db actions state ev
handleEvent _ _ state _ = Brick.continue state

-- | Runs when the app starts
-- Adds paste support
appStart :: State -> EventM ResourceName State
appStart state = do
output <- outputIface <$> getVtyHandle
when (supportsMode output BracketedPaste) . liftIO $ setMode output BracketedPaste True
pure state
h <- getHeight
pure (setHeight h state)

-- | Sets up Brick
go :: Config -> State -> IO ()
Expand Down
2 changes: 1 addition & 1 deletion src/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ClassyPrelude
import Data.FileEmbed (embedFile)

version :: Text
version = "1.4.3"
version = "1.5.0"

usage :: Text
usage = decodeUtf8 $(embedFile "templates/usage.txt")
3 changes: 3 additions & 0 deletions src/Data/Taskell/List.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module Data.Taskell.List
, deleteTask
, getTask
, searchFor
, nextTask
, prevTask
, nearest
) where

import Data.Taskell.List.Internal
49 changes: 47 additions & 2 deletions src/Data/Taskell/List/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Data.Taskell.List.Internal where

import ClassyPrelude

import Control.Lens (ix, makeLenses, (%%~), (%~), (&), (.~), (^.), (^?))
import Control.Lens (element, makeLenses, (%%~), (%~), (&), (.~), (^.), (^?))

import Data.Sequence as S (adjust', deleteAt, insertAt, update, (|>))

Expand Down Expand Up @@ -59,7 +59,52 @@ deleteTask :: Int -> Update
deleteTask idx = tasks %~ deleteAt idx

getTask :: Int -> List -> Maybe T.Task
getTask idx = (^? tasks . ix idx)
getTask idx = (^? tasks . element idx)

searchFor :: Text -> Update
searchFor text = tasks %~ filter (T.contains text)

changeTask :: Int -> Int -> Maybe Text -> List -> Maybe Int
changeTask dir current term list = do
let next = current + dir
tsk <- getTask next list
case term of
Nothing -> Just next
Just trm ->
if T.contains trm tsk
then Just next
else changeTask dir next term list

nextTask :: Int -> Maybe Text -> List -> Int
nextTask idx text lst = fromMaybe idx $ changeTask 1 idx text lst

prevTask :: Int -> Maybe Text -> List -> Int
prevTask idx text lst = fromMaybe idx $ changeTask (-1) idx text lst

closest :: Int -> Int -> Int -> Int
closest current previous next =
if (next - current) < (current - previous)
then next
else previous

bound :: Int -> List -> Int
bound idx lst
| idx < 0 = 0
| idx > count lst = count lst - 1
| otherwise = idx

nearest' :: Int -> Maybe Text -> List -> Maybe Int
nearest' current term lst = do
let prev = changeTask (-1) current term lst
let nxt = changeTask 1 current term lst
let comp idx = Just $ maybe idx (closest current idx) nxt
maybe nxt comp prev

nearest :: Int -> Maybe Text -> List -> Int
nearest current term lst = idx
where
near = fromMaybe (-1) $ nearest' current term lst
idx =
case term of
Nothing -> bound current lst
Just txt -> maybe near (bool near current . T.contains txt) $ getTask current lst
Loading

0 comments on commit dfbdbc9

Please sign in to comment.