HaskerDeux

Check-in [02acc587fc]
Login

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

Overview
Comment:Update README to reflect it works again
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/issue1 | trunk | master
Files: files | file ages | folders
SHA3-256: 02acc587fcea091032726b82e6a52a1ec90179739f46d9f12c4cd904e8c3e821
User & Date: base@atomicules.co.uk 2016-12-03 00:07:11
Context
2016-12-04
15:09
hlint changes

- Duplication between curldelete and curlput still exists, but I think is
legitimate.
- Also, I'm really not sure use of Control.Applicative makes
it any more readable, but I'll go with it.
- Would also be nice if I could get all the isInfixOf the same check-in: 6b4d755c96 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-12-03
00:07
Update README to reflect it works again check-in: 02acc587fc user: base@atomicules.co.uk tags: origin/issue1, trunk, master
2016-12-02
23:28
Add back in "new" todo functionality.

Now, finally, has the same functionality it did four years ago!

But is a messy piece of crap. In fact it's pretty horrible, but it works
so if I'm really honest I'm probably just going to leave it like this. I
just can gel with Haskell like I can Erlang (and I ain't saying I'm good
there).

Things of note:

- Remembered why I needed Just/Maybe on the curlpost
- The json bit in the curlpost, need to let the statements rather than
returning them directly. I don't understand why, but get errors.
- The way the curlpost works to sort out the correct json string
depending on whether adding a new todo or modifying an existing is
just horrible. I really need to figure out using association lists as
args and cleanly converting these to a json string. check-in: 5927c4835d 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
..
36
37
38
39
40
41
42
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.


##Status

Abandonware. TeuxDeux released a Neux version and I waited a year but the corresponding new API did not come and I really missed command line access so I jumped ship to taskwarrior.


##Requirements

You need the following Haskell packages installed:

- Data.List.Split
- Network.Curl
- 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 currently includes the following commands: 

###Today

................................................................................

You can use those numbers with the PutOff and CheckOff commands.

###New

For creating new tasks

`haskerdeux new "<A todo item>" <username> <password>`

E.g:

`haskerdeux new "Stop procrastinating" superprocrastinator mysecretpassword`

(Supplying username and password on the command line)

###PutOff

For putting off a task until tomorrow.

`haskerdeux putoff <tasknumber from today list> <username> <password>`

E.g:

`haskerdeux putoff 3`

(Using username and password stored in `.netrc`)

###MoveTo

For moving a task to another date.

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

E.g:

`haskerdeux moveto 11 2012-09-01`

###CrossOff

For marking a task as complete

`haskerdeux crossoff <tasknumber from today list> <username> <password>`

###Delete

For completely removing a task

`haskerdeux delete <tasknumber from today list> <username> <password>`


##Using .netrc For Storing Username and Password

The `<username>` and `<password>` arguments are optional. If not supplied then it attempts to read them 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.

##Proxy Support

I went with [Network.Curl](http://hackage.haskell.org/package/curl) because proxy support was a must for me and I couldn't figure it out (at least not using authentication) with things like http-enumerator or http-conduit. Anyway, I spent ages figuring out checking for environment variables and building the proxy options to Curl, but seems like there is no need: As long as you have the `https_proxy` environment variable set, Curl finds it by default and does it automatically. So even works where authentication is required. You just need something like the following in `.bashrc`, etc.

`export proxy https_proxy="<username>:<password>@<proxyserveraddress>:<proxyport>"`

##Development

I plan/hope to be able to re-create what [Badboy did in Ruby](https://github.com/badboy/teuxdeux) in Haskell. So in the develop branch I am going to split out the API stuff from the command line client - because I might keep the command line client lighter; I like the above functionality, I just want the code to be a bit cleaner.


##Thanks

Some resources that helped me figure this out:

- [Badboy's Teuxdeux](https://github.com/badboy/teuxdeux) and his documentation of the [Unofficial API](https://github.com/badboy/teuxdeux/wiki/API)
- [Extended sessions with the Haskell Curl bindings](http://flygdynamikern.blogspot.it/2009/03/extended-sessions-with-haskell-curl.html) without which I would have never figured out Network.Curl
- [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.




>



|







<



>







 







|
<
<
<
<
<
<





|





<
<




|









|





|
>



|











<
<
<
<
<



|
>





<
<

>
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
..
37
38
39
40
41
42
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
#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.


##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 currently includes the following commands: 

###Today

................................................................................

You can use those numbers with the PutOff and CheckOff commands.

###New

For creating new tasks

`haskerdeux new "<A todo item>"`







###PutOff

For putting off a task until tomorrow.

`haskerdeux putoff <tasknumber from today list>`

E.g:

`haskerdeux putoff 3`



###MoveTo

For moving a task to another date.

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

E.g:

`haskerdeux moveto 11 2012-09-01`

###CrossOff

For marking a task as complete

`haskerdeux crossoff <tasknumber from today list>`

###Delete

For completely removing a task

`haskerdeux delete <tasknumber from today 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).