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.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Apr 1, 2019
2 parents 2af9069 + a98ff50 commit 46bcb73
Show file tree
Hide file tree
Showing 28 changed files with 640 additions and 180 deletions.
5 changes: 5 additions & 0 deletions .bin/heap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
stack build taskell --work-dir .stack-work-profile --profile
stack exec taskell --work-dir .stack-work-profile --rts-options -hm
hp2ps -s -m0 -c -M taskell.hp
open taskell.ps
rm taskell.hp
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
taskell.json
taskell.cabal
taskell.md
taskell.aux
taskell.ps
test.md
large.md
.stack-work/
.stack-work-profile/
releases/
homebrew-taskell/
58 changes: 53 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ Follow [@taskellcli](https://twitter.com/taskellcli) on Twitter for updates
- [Installation](#installation)
- [Using Taskell](#using-taskell)
- [Options](#options)
- [Controls](#controls)
- [Storage](#storage)
- [Importing Trello Boards](#importing-trello-boards)
- [Importing GitHub Projects](#importing-github-projects)
- [Configuration](#configuration)
- [Controls](#controls)
- [Theming](#theming)
- [Roadmap](#roadmap)

Expand Down Expand Up @@ -83,10 +83,6 @@ If none of the above options work you can build taskell using [Stack](https://do
- `-t <trello-board-id>`: import a Trello board ([see below](#importing-trello-boards))
- `-g <github-project-id>`: import a GitHub project ([see below](#importing-github-projects))

### Controls

Press `?` for a [list of controls](https://github.com/smallhadroncollider/taskell/blob/master/templates/controls.md)

#### Tips

- If you're using a simple two-column "To Do" and "Done" then use the space bar to mark an item as complete while staying in the "To Do" list. If you're using a more complicated column setup then you will want to use `H`/`L` to move tasks between columns.
Expand Down Expand Up @@ -251,6 +247,58 @@ subtask = "-"

**Warning**: currently if you change your `[markdown]` settings any older files stored with different settings will not be readable.

### Controls

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 = <
```

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

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


### Theming

You can edit Taskell's colour-scheme by editing `theme.ini`:
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: taskell
tagline: Command-line Kanban board/task managment
baseurl: ""
locale: "en"
version: 1.3.6
version: 1.4.0
destination: _site/public
exclude: [deployment, Capfile, log, Gemfile, Gemfile.lock]

Expand Down
8 changes: 7 additions & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: taskell
version: '1.3.6.0'
version: '1.4.0.0'
category: Command Line Tools
author: Mark Wales
maintainer: mark@smallhadroncollider.com
Expand Down Expand Up @@ -46,11 +46,15 @@ library:
- IO.HTTP.GitHub
- IO.HTTP.Trello.List
- IO.HTTP.Trello.ChecklistItem
- IO.Keyboard
- IO.Keyboard.Parser
- IO.Keyboard.Types
- UI.Field

dependencies:
- base <=5
- aeson
- attoparsec
- brick
- bytestring
- config-ini
Expand Down Expand Up @@ -94,10 +98,12 @@ tests:
- containers
- file-embed
- lens
- raw-strings-qq
- taskell
- tasty
- tasty-discover
- tasty-expected-failure
- tasty-hunit
- text
- time
- vty
35 changes: 22 additions & 13 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@
## Refactoring

- Add tests for IO.GitHub
- Use Shake instead of bash script
- 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
- Add a List widget for common actions between tasks and sub-tasks
- Tidy up load functions in IO.Taskell
- Remove `~` style sub-task complete parsing
@ 2018-12-10
- Use Shake instead of bash script

## Bugs

- Can't remove a description
- Very long words should get hyphenated
> The cursor gets lost if a word is longer than the line - URLs in particular can cause issues
- Help modal needs to wrap and scroll
Expand All @@ -42,6 +40,16 @@

## Features

- Use proper error codes
- Performance with large files
> Becomes unusable with large files
* [x] Initially use debouncing to avoid writing too often
* [ ] Cache formatting results
* [ ] 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?)
Expand All @@ -50,8 +58,6 @@
- Check times work no matter what timezone
- Import Issues from GitHub using labels
- Show filename somewhere
- Editable title?
> Use a `# Title` at top of file and display title somewhere in taskell
- Add tags/labels with `t`
- URL field - plus config to run specific command when selected (e.g. `open -a Chrome.app #{url}`)
- Redo functionality
Expand All @@ -71,18 +77,21 @@
> Either command line arguments for settings or just a `-c other.ini` command
- 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
## In Progress

- Add custom key support
- Use proper error codes
- Performance with large files
> Becomes unusable with large files
* [x] Initially use debouncing to avoid writing too often
* [ ] Cache formatting results
* [ ] Invalidate layout cache less frequently
* [ ] Benchmarking tests
* [ ] Allow cancelling write to avoid trying to write the same file at the same time
* [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)
* [ ] 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
* [ ] Add keys to Help which aren't in bindings
- Add a List widget for common actions between tasks and sub-tasks
- Can't remove a description

## Done

Expand Down
40 changes: 21 additions & 19 deletions src/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import qualified Control.FoldDebounce as Debounce

import Data.Taskell.Date (currentDay)
import Data.Taskell.Lists (Lists)
import Events.Actions (event)
import Events.Actions (ActionSets, event, generateActions)
import Events.State (continue, countCurrent)
import Events.State.Types (State, current, io, lists, mode, path)
import Events.State.Types.Mode (InsertMode (..), InsertType (..), ModalType (..), Mode (..))
import IO.Config (Config, generateAttrMap, layout)
import IO.Config (Config, generateAttrMap, getBindings, layout)
import IO.Taskell (writeData)
import UI.Draw (chooseCursor, draw)
import UI.Types (ResourceName (..))
import UI.Types (ListIndex (..), ResourceName (..), TaskIndex (..))

type DebouncedMessage = (Lists, FilePath)

Expand Down Expand Up @@ -51,7 +51,7 @@ debounce config initial = do
Debounce.new
Debounce.Args
{ Debounce.cb = store config
, Debounce.fold = \_ b -> b
, Debounce.fold = flip const
, Debounce.init = (initial ^. lists, initial ^. path)
}
Debounce.def
Expand All @@ -63,27 +63,28 @@ clearCache :: State -> EventM ResourceName ()
clearCache state = do
let (li, ti) = state ^. current
invalidateCacheEntry (RNList li)
invalidateCacheEntry (RNTask (li, ti))
invalidateCacheEntry (RNTask (ListIndex li, TaskIndex ti))

clearAllTitles :: State -> EventM ResourceName ()
clearAllTitles state = do
let count = length (state ^. lists)
let range = [0 .. (count - 1)]
void . sequence $ invalidateCacheEntry . RNList <$> range
void . sequence $ invalidateCacheEntry . (\x -> RNTask (x, -1)) <$> range
traverse_ (invalidateCacheEntry . RNList) range
traverse_ (invalidateCacheEntry . RNTask . flip (,) (TaskIndex (-1)) . ListIndex) range

clearList :: State -> EventM ResourceName ()
clearList state = do
let (list, _) = state ^. current
let count = countCurrent state
let range = [0 .. (count - 1)]
invalidateCacheEntry $ RNList list
void . sequence $ invalidateCacheEntry . (\x -> RNTask (list, x)) <$> range
traverse_ (invalidateCacheEntry . RNTask . (,) (ListIndex list) . TaskIndex) range

-- event handling
handleVtyEvent :: (DebouncedWrite, Trigger) -> State -> Event -> EventM ResourceName (Next State)
handleVtyEvent (send, trigger) previousState e = do
let state = event e previousState
handleVtyEvent ::
(DebouncedWrite, Trigger) -> ActionSets -> State -> Event -> EventM ResourceName (Next State)
handleVtyEvent (send, trigger) actions previousState e = do
let state = event actions e previousState
case previousState ^. mode of
Search _ _ -> invalidateCache
(Modal MoveTo) -> clearAllTitles previousState
Expand All @@ -97,20 +98,20 @@ handleVtyEvent (send, trigger) previousState e = do

handleEvent ::
(DebouncedWrite, Trigger)
-> ActionSets
-> State
-> BrickEvent ResourceName e
-> EventM ResourceName (Next State)
handleEvent _ state (VtyEvent (EvResize _ _)) = invalidateCache *> Brick.continue state
handleEvent db state (VtyEvent ev) = handleVtyEvent db state ev
handleEvent _ state _ = Brick.continue 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

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

-- | Sets up Brick
Expand All @@ -119,11 +120,12 @@ go config initial = do
attrMap' <- const <$> generateAttrMap
today <- currentDay
db <- debounce config initial
bindings <- getBindings
let app =
App
{ appDraw = draw (layout config) today
{ appDraw = draw (layout config) bindings today
, appChooseCursor = chooseCursor
, appHandleEvent = handleEvent db
, appHandleEvent = handleEvent db (generateActions bindings)
, appStartEvent = appStart
, appAttrMap = attrMap'
}
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.3.6"
version = "1.4.0"

usage :: Text
usage = decodeUtf8 $(embedFile "templates/usage.txt")
Loading

0 comments on commit 46bcb73

Please sign in to comment.