insanum / sncli

Simplenote CLI
MIT License
396 stars 34 forks source link

implemented a JSON import switch #29

Closed retrography closed 7 years ago

retrography commented 8 years ago

I needed it to import my notes from nvAlt and LetterSpace (see https://gist.github.com/retrography/6d727c1e018ce7b38d546bed9ff129ba)

samuelallan72 commented 8 years ago

@retrography this looks pretty good - an import feature will be useful! Before this is merged in, I'd like to get issue #20 fully resolved. (See localkeys branch.) It will probably result in some changes needed in the import code here as well.

retrography commented 8 years ago

@swalladge So, please ping me when you are done with that, so I can fix what needs to be amended.

samuelallan72 commented 7 years ago

@retrography sorry for the long delay... just letting you know I'm looking at this now. At a quick glance it should fit it easily without much/any changes. :)

samuelallan72 commented 7 years ago

Ok, it's merged into the import branch now. Roadmap:

Please let me know if I've missed something or there are any issues.

samuelallan72 commented 7 years ago

Apparent issues on initial testing:

  1. no way to tell (without looking at the logs) whether the import succeeded or failed
  2. since the values aren't sanitized, it's easy to break the whole thing by importing something like {"content":1} (value is a number not a string) - this will fail syncing to the server and crash sncli next time it starts.

Proposed fixes:

  1. force messages relating to importing to print regardless of verbose level set, and exit the program with a fail status if failed.
  2. make sure the values are sanity checked when importing, also some way to get feedback from the syncing process as to whether the note is valid or not (ie. server side validation).

I'll attempt to work on this over the weekend (time permitting). Feel free to add any comments/ideas. :)

samuelallan72 commented 7 years ago

Done! Hopefully all is satisfactory. Please open a new issue if there are any problems. :)