# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

import lib.git, lib.args, lib.json, lib.time

def commit ( message, duration, authors = None ) :

	authors = lib.args.listify( authors )

	with lib.json.proxy( "contributions.json", mode = "w", default = [] ) as contribs :

		contribs.append( {

			"authors" : authors,
			"message" : message,
			"duration" : duration,
			"timestamp" : str( lib.time.nanoseconds() )

		} )

	lib.git.add( "contributions.json" )
	lib.git.commit( "-m", message )

@@ -145,16 +145,29 @@
 lib.time
+, collections
 %0A%0Adef co
@@ -252,16 +252,49 @@
 hors )%0A%0A
+%09hook = collections.OrderedDict%0A%0A
 %09with li
@@ -353,16 +353,42 @@
 ult = %5B%5D
+, object_pairs_hook = hook
  ) as co
@@ -420,14 +420,22 @@
 nd( 
-%7B
+hook( %5B
 %0A%0A%09%09%09
+( 
 %22aut
@@ -443,18 +443,17 @@
 ors%22
- :
+,
  authors
 ,%0A%09%09
@@ -448,21 +448,25 @@
  authors
+ )
 ,%0A%09%09%09
+( 
 %22message
@@ -470,18 +470,17 @@
 age%22
- :
+,
  message
 ,%0A%09%09
@@ -475,21 +475,25 @@
  message
+ )
 ,%0A%09%09%09
+( 
 %22duratio
@@ -494,18 +494,17 @@
 uration%22
- :
+,
  duratio
@@ -504,21 +504,25 @@
 duration
+ )
 ,%0A%09%09%09
+( 
 %22timesta
@@ -524,18 +524,17 @@
 mestamp%22
- :
+,
  str( li
@@ -559,13 +559,17 @@
 () )
+ )
 %0A%0A%09%09
-%7D
+%5D )
  )%0A%0A

order dict keys in contrib.commit