HaskerDeux

Check-in [a393b4c91b]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Sort out markup in README
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/issue1 | trunk | master
Files: files | file ages | folders
SHA3-256: a393b4c91b133bda8a5e7eb8033adbf913cd8fdb497a47183bf6fbbb96c87ff5
User & Date: base@atomicules.co.uk 2017-10-22 10:56:17
Context
2017-10-29
17:10
Handle automatic re-login on each separate curl call

I.e. rather than check the validity of the token each time by making a
curl call to get a list of todos (whatever action is being performed)
just assume the token is valid and wait for the actual action to fail.
Relogin at that point and re-call that action.

It's still messy, but I think this approach is right - it'll just be my
implementation of it that lets the side down. check-in: 76a89c1a9b user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2017-10-22
10:56
Sort out markup in README check-in: a393b4c91b user: base@atomicules.co.uk tags: origin/issue1, trunk, master
10:44
Enable auto-login if token has expired

Note: I am aware this is terribly unhaskelly, but making it work was my
main aim, making it less terrible will come. There's also a fair bit of
repetition here.

This tries to get a list of todos whatever the command and checks the
response for an invalid csrf token, if that occurs it removes the file
and calls login again.

This means that if you are actually calling for a list of todos it ends
up doing it twice which is a bit rubbish really. It would be nicer for
it to:

1. Call whatever command is asked for
2. Catch a invalid_csrf_token in the response
3. Re-login
4. Continue to call the original command

It might never be that good, but I do hope at least to get rid of all
the if/then/else though. check-in: e53b9e78fb user: base@atomicules.co.uk tags: origin/issue1, trunk, master

Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to README.markdown.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#Haskerdeux - A Simple Command Line Client for Teuxdeux in Haskell

Written with the dual purpose of being a learning exercise for Haskell and also because I really wanted a command line tool for [Teuxdeux](http://teuxdeux.com). As it stands this is a bit rough and ready, but it does work.

It used to use Network.Curl, but I can't get that to work anymore so I'm doing straight system calls to curl which means it's not very Haskelly and ultimately a bit of a pointless use of Haskell, but it's for me, so there.

##Status

Alive! Official status is "Messy and works for me, unlikely to improve"; It was dead for years because I didn't think it was possible to get the new API to work.


##Requirements

You need the following Haskell packages installed:

- Data.List.Split
- Text.JSON

I also suggest you compile it to use it - it's much faster to use that way. Just do `ghc --make haskerdeux.hs`. If you don't compile it then replace `./haskerdeux` in the examples below with `runhaskell haskerdeux.hs`.


##Features/Commands

Haskerdeux works in the following way:

`haskerdeux <date> <command> <optional args>`

I.e. the date supplied is the date the commands act on. It understands "today", "tomorrow" and dates in "YYYY-MM-DD" format. All commands recognise and require a date.

It includes the following commands: 


###Todos

For listing todos only (as that is all I want to see)

`haskerdeux today todos`
`haskerdeux tomorrow todos`
`haskerdeux 2017-02-28 todos`

................................................................................
	0 - Write README for Haskerdeux
	1 - Write Blog post about Haskerdeux
	2 - Split development work in different branch
	3 - Perhaps do some actual work you are paid to do

You can use those numbers with the PutOff and CrossOff commands, etc.

###New

For creating new tasks

`haskerdeux today new "<A todo item for today>"`
`haskerdeux tomorrow new "<A todo item for tomorrow>"`

###PutOff

For putting off a task until the next day.

`haskerdeux today putoff <tasknumber from todos list>`

E.g:

`haskerdeux today putoff 3`

###MoveTo

For moving a task to another date.

`haskerdeux today moveto <tasknumber from todos list> <date in YYYY:MM:DD>`

E.g:

`haskerdeux today moveto 11 2012-09-01`

###CrossOff

For marking a task as complete

`haskerdeux today crossoff <tasknumber from todos list>`

###Delete

For completely removing a task

`haskerdeux today delete <tasknumber from todos list>`


##Using .netrc For Storing Username and Password

It's compulsory. It used to support passing username/password as command line args, but no more. The `<username>` and `<password>` are read from `.netrc`. Just add an entry to `.netrc` as follows:

	machine teuxdeux.com
		login superprocrastinator
		password mysecretpassword

................................................................................
Or the single line format:

	machine teuxdeux.com loging superprocrastinator password mysecretpassword

It should work ok with either format. It won't work if you have spaces in your password though.


##Development

Nope.


##Thanks

Some resources that helped me figure this out:

- [A Haskell Newbies Guide to Text.JSON](http://www.amateurtopologist.com/blog/2010/11/05/a-haskell-newbies-guide-to-text-json/) and especially the comments explaining the generic approach.
- For the new API and making me realise it was possible to make this work once again, [dmi3's TeuxDeux Unofficial API for Python](https://github.com/dmi3/teuxdeux).
|





|




|









|










|







 







|






|









|









|





|






|







 







|




|





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
..
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Haskerdeux - A Simple Command Line Client for Teuxdeux in Haskell

Written with the dual purpose of being a learning exercise for Haskell and also because I really wanted a command line tool for [Teuxdeux](http://teuxdeux.com). As it stands this is a bit rough and ready, but it does work.

It used to use Network.Curl, but I can't get that to work anymore so I'm doing straight system calls to curl which means it's not very Haskelly and ultimately a bit of a pointless use of Haskell, but it's for me, so there.

## Status

Alive! Official status is "Messy and works for me, unlikely to improve"; It was dead for years because I didn't think it was possible to get the new API to work.


## Requirements

You need the following Haskell packages installed:

- Data.List.Split
- Text.JSON

I also suggest you compile it to use it - it's much faster to use that way. Just do `ghc --make haskerdeux.hs`. If you don't compile it then replace `./haskerdeux` in the examples below with `runhaskell haskerdeux.hs`.


## Features/Commands

Haskerdeux works in the following way:

`haskerdeux <date> <command> <optional args>`

I.e. the date supplied is the date the commands act on. It understands "today", "tomorrow" and dates in "YYYY-MM-DD" format. All commands recognise and require a date.

It includes the following commands: 


### Todos

For listing todos only (as that is all I want to see)

`haskerdeux today todos`
`haskerdeux tomorrow todos`
`haskerdeux 2017-02-28 todos`

................................................................................
	0 - Write README for Haskerdeux
	1 - Write Blog post about Haskerdeux
	2 - Split development work in different branch
	3 - Perhaps do some actual work you are paid to do

You can use those numbers with the PutOff and CrossOff commands, etc.

### New

For creating new tasks

`haskerdeux today new "<A todo item for today>"`
`haskerdeux tomorrow new "<A todo item for tomorrow>"`

### PutOff

For putting off a task until the next day.

`haskerdeux today putoff <tasknumber from todos list>`

E.g:

`haskerdeux today putoff 3`

### MoveTo

For moving a task to another date.

`haskerdeux today moveto <tasknumber from todos list> <date in YYYY:MM:DD>`

E.g:

`haskerdeux today moveto 11 2012-09-01`

### CrossOff

For marking a task as complete

`haskerdeux today crossoff <tasknumber from todos list>`

### Delete

For completely removing a task

`haskerdeux today delete <tasknumber from todos list>`


## Using .netrc For Storing Username and Password

It's compulsory. It used to support passing username/password as command line args, but no more. The `<username>` and `<password>` are read from `.netrc`. Just add an entry to `.netrc` as follows:

	machine teuxdeux.com
		login superprocrastinator
		password mysecretpassword

................................................................................
Or the single line format:

	machine teuxdeux.com loging superprocrastinator password mysecretpassword

It should work ok with either format. It won't work if you have spaces in your password though.


## Development

Nope.


## Thanks

Some resources that helped me figure this out:

- [A Haskell Newbies Guide to Text.JSON](http://www.amateurtopologist.com/blog/2010/11/05/a-haskell-newbies-guide-to-text-json/) and especially the comments explaining the generic approach.
- For the new API and making me realise it was possible to make this work once again, [dmi3's TeuxDeux Unofficial API for Python](https://github.com/dmi3/teuxdeux).