Skip to content

Commit

Permalink
history command limits entries to handle if given
Browse files Browse the repository at this point in the history
  • Loading branch information
F483 committed Feb 24, 2017
1 parent b911a1d commit 0f5cbfd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ PicoPayments CLI
|BuildLink|_ |CoverageLink|_ |LicenseLink|_ |IssuesLink|_


.. |BuildLink| image:: https://travis-ci.org/StorjRND/picopayments-cli-python.svg
.. _BuildLink: https://travis-ci.org/StorjRND/picopayments-cli-python
.. |BuildLink| image:: https://travis-ci.org/F483/picopayments-cli-python.svg
.. _BuildLink: https://travis-ci.org/F483/picopayments-cli-python

.. |CoverageLink| image:: https://coveralls.io/repos/StorjRND/picopayments-cli-python/badge.svg
.. _CoverageLink: https://coveralls.io/r/StorjRND/picopayments-cli-python
.. |CoverageLink| image:: https://coveralls.io/repos/F483/picopayments-cli-python/badge.svg
.. _CoverageLink: https://coveralls.io/r/F483/picopayments-cli-python

.. |LicenseLink| image:: https://img.shields.io/badge/license-MIT-blue.svg
.. _LicenseLink: https://raw.githubusercontent.com/F483/picopayments-cli-python/master/LICENSE
Expand Down
14 changes: 9 additions & 5 deletions picopayments_cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def queuepayment(source, destination, quantity, token=None):
hub_api = _hub_api()
data = _load_data()
client = Mph.deserialize(hub_api, data["connections"][source])
# FIXME check dest can receive payment
# TODO check dest can receive payment
result = client.micro_send(destination, quantity, token=token)
data["connections"][source] = client.serialize()
_save_data(data)
Expand Down Expand Up @@ -369,7 +369,8 @@ def close(handle):
data = _load_data()
client = Mph.deserialize(hub_api, data["connections"][handle])
commit_txid = client.close()
# FIXME recover now if possible
# TODO flag as closed in case hub delays close
# TODO recover now if possible
data["connections"][handle] = client.serialize()
_save_data(data)
return commit_txid
Expand All @@ -385,11 +386,14 @@ def history(handle=None):
Returns:
List of previous actions made.
"""
# FIXME limit to handle if given
entries = []
if os.path.exists(etc.history_path):
with open(etc.history_path, 'r') as csvfile:
return list(csv.DictReader(csvfile))
return []
for entrie in list(csv.DictReader(csvfile)):
if handle is not None and entrie["handle"] != handle:
continue
entries.append(entrie)
return entries


@dispatcher.add_method
Expand Down

0 comments on commit 0f5cbfd

Please sign in to comment.