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/0.10.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
smallhadroncollider committed Feb 12, 2018
2 parents a4f4dde + 77b7f9a commit af7e365
Show file tree
Hide file tree
Showing 13 changed files with 118 additions and 52 deletions.
1 change: 1 addition & 0 deletions .bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Release Template
- Mac (Homebrew): \`brew install smallhadroncollider/taskell/taskell\`
- Mac/Linux: download binary and place it in a directory in your \`\$PATH\` (e.g. \`/usr/local/bin\`)
- Debian (including Ubuntu): download the \`.deb\` file and run \`dpkg -i taskell-$1_x86-64-linux.deb\`
- Fedora: Run `sudo dnf install ncurses-compat-libs` then download and run binary as described above

---------------------------------------------
"
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Run `sudo dnf install ncurses-compat-libs` then download and run binary as descr

## Storage

Stores in a local `taskell.md` file:
By default stores in a `taskell.md` file in the working directory:

```md
## To Do
Expand All @@ -82,6 +82,23 @@ Stores in a local `taskell.md` file:
- Do That
```

## Theming

You can edit Taskell's colourscheme by editing `~/.taskell/theme.ini`:

```ini
[default]
default.bg = brightBlack
default.fg = white

[other]
title.fg = green
titleCurrent.fg = blue
taskCurrent.fg = magenta
```

The available colours are: `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `brightBlack`, `brightRed`, `brightGreen`, `brightYellow`, `brightBlue`, `brightMagenta`, `brightCyan`, `brightWhite`, or `default`

---

## Roadmap
Expand Down
2 changes: 2 additions & 0 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Main where
import Control.Monad (when)
import Flow.State (create)
import Persistence.Taskell (exists, readFile)
import Persistence.Config (setup)
import System.Console.Terminal.Size (Window(..), size)

import App (go)
Expand All @@ -24,5 +25,6 @@ start path = do
-- if taskell.md exists/created then start
main :: IO ()
main = do
setup
(ex, path) <- exists
when ex $ start path
17 changes: 10 additions & 7 deletions roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

- Nix support?
- apt-get repository
- Use case examples in README

## Refactoring

- Use Brick for UI
- Break up State module
- Simplify state by composing Actions
- Use a map in Actions to tidy things up/add custom key support
Expand All @@ -15,24 +13,26 @@

## Bugs

- Items near bottom of the list jump in position
- List titles sometimes go missing
- Up and down in search gets a bit lost
- Editing list title doesn't always have visibility
- Vertical spacing doesn't work if the current item is blank
- Cursor goes missing on the left hand side at the end of a line

## To Do

- `.taskell` config file in home directory
- Left/Right arrow keys in insert mode
- If column width is more than the screen width then padding and width should be reduced so that it fits (within reason)
- Add tags/labels with `t`
- Move between lists with `m` - shows possible lists
- On `?` show keyboard commands
- Add due dates to tasks with `d`
- `.taskell` config file in home directory
- URL field - plus config to run specific command when selected (e.g. `open -a Chrome.app #{url}`)
- Copy and paste?
- Add custom key support
- Add Trello import
- Add `--convert-to-md` and `--convert-to-json` options
- Multi-select mode
- Sub-lists
- Spell check?

## Done

Expand Down Expand Up @@ -102,3 +102,6 @@
- Use concurrency for IO
- Search UI
- Vertical scrolling hides list titles
- Use Brick for UI
- `C` doesn't work properly
- Custom colours
10 changes: 5 additions & 5 deletions src/App.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Persistence.Taskell (writeFile)
import Flow.Actions (event)

import UI.Draw (draw, chooseCursor, scroll)
import UI.Attr (attrMap')
import UI.Theme (generateAttrMap)
import UI.Types (ResourceName(..))

-- store
Expand All @@ -28,8 +28,8 @@ handleEvent s' (VtyEvent e) = let s = event e s' in
_ -> scroll s >> Brick.continue s
handleEvent s _ = Brick.continue s

app :: App State e ResourceName
app = App draw chooseCursor handleEvent return attrMap'

go :: State -> IO ()
go initial = void (defaultMain app initial)
go initial = do
attrMap' <- const <$> generateAttrMap
let app = App draw chooseCursor handleEvent return attrMap'
void (defaultMain app initial)
4 changes: 2 additions & 2 deletions src/Data/Taskell/Task.hs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module Data.Taskell.Task where

import Data.Text (Text, snoc, length, null, isInfixOf)
import Data.Text (Text, snoc, length, null, isInfixOf, empty)
import qualified Data.Taskell.Text as T

newtype Task = Task {
description :: Text
} deriving (Show, Eq)

blank :: Task
blank = Task { description = "" }
blank = Task { description = empty }

clear :: Task -> Task
clear _ = blank
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Taskell/Text.hs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ spl :: Text -> [Text]
spl = Data.Text.foldl' spl' [empty]

wrap :: Int -> Text -> [Text]
wrap width = Data.List.foldl' (combine width) [] . spl
wrap width = Data.List.foldl' (combine width) [empty] . spl

combine :: Int -> [Text] -> Text -> [Text]
combine width acc s = if nl then acc ++ [strip s] else Data.Taskell.Text.append (l `Data.Text.append` s) acc
where l = if Prelude.null acc then "" else last acc
where l = if Prelude.null acc then empty else last acc
nl = textWidth l + textWidth s > width

append :: Text -> [Text] -> [Text]
Expand Down
6 changes: 1 addition & 5 deletions src/Flow/State.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ startCreate :: Stateful
startCreate s = return $ s { mode = Insert CreateTask }

startEdit :: Stateful
startEdit s = do
c <- getCurrentTask s
return $ if isBlank c
then s
else s { mode = Insert EditTask }
startEdit s = return $ s { mode = Insert EditTask }

normalMode :: Stateful
normalMode s = return $ s { mode = Normal }
Expand Down
35 changes: 35 additions & 0 deletions src/Persistence/Config.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module Persistence.Config where

import System.Directory

getDir :: IO FilePath
getDir = (++ "/.taskell") <$> getHomeDirectory

getThemePath :: IO FilePath
getThemePath = do
dir <- getDir
return $ dir ++ "/theme.ini"

setup :: IO ()
setup = do
dir <- getDir
createDirectoryIfMissing True dir
createTheme

writeTheme :: FilePath -> IO ()
writeTheme path = writeFile path $ unlines [
"[default]",
"default.bg = brightBlack",
"default.fg = white",
"",
"[other]",
"title.fg = green",
"titleCurrent.fg = blue",
"taskCurrent.fg = magenta"
]

createTheme :: IO ()
createTheme = do
path <- getThemePath
exists <- doesFileExist path
if exists then return () else writeTheme path
27 changes: 0 additions & 27 deletions src/UI/Attr.hs

This file was deleted.

2 changes: 1 addition & 1 deletion src/UI/Draw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import qualified Data.Sequence as Seq (mapWithIndex, length)
import Config

import UI.Types (ResourceName(..))
import UI.Attr
import UI.Theme

colWidth :: Int
colWidth = width + padding * 2
Expand Down
38 changes: 38 additions & 0 deletions src/UI/Theme.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module UI.Theme where

import Brick.Themes (Theme, newTheme, themeToAttrMap, loadCustomizations)
import Brick (AttrName, AttrMap, attrName)
import Brick.Util (fg, on)
import Graphics.Vty (white, brightBlack, green, blue, magenta)
import Persistence.Config (getThemePath)

-- attrs
titleAttr :: AttrName
titleAttr = attrName "title"

titleCurrentAttr :: AttrName
titleCurrentAttr = attrName "titleCurrent"

taskCurrentAttr :: AttrName
taskCurrentAttr = attrName "taskCurrent"

taskAttr :: AttrName
taskAttr = attrName "task"

-- default theme
defaultTheme :: Theme
defaultTheme =
newTheme (white `on` brightBlack) [
(attrName "title", fg green),
(attrName "titleCurrent", fg blue),
(attrName "taskCurrent", fg magenta)
]

-- generate theme
generateAttrMap :: IO AttrMap
generateAttrMap = do
path <- getThemePath
customizedTheme <- loadCustomizations path defaultTheme
return . themeToAttrMap $ case customizedTheme of
Left _ -> defaultTheme
Right theme -> theme
5 changes: 3 additions & 2 deletions taskell.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: taskell
version: 0.10.1.0
version: 0.10.2.0
-- synopsis: A CLI task manager, written in Haskell
-- description: Allows you to create version controlled task lists
homepage: https://github.com/smallhadroncollider/taskell#readme
Expand Down Expand Up @@ -41,10 +41,11 @@ library

, Persistence.Taskell
, Persistence.Markdown
, Persistence.Config

, UI.CLI
, UI.Draw
, UI.Attr
, UI.Theme
, UI.Types

build-depends: base <= 5
Expand Down

0 comments on commit af7e365

Please sign in to comment.