rafaelrinaldi / hn-cli

:newspaper: CLI to browse Hacker News
MIT License
460 stars 19 forks source link

Mark visited items #8

Open rafaelrinaldi opened 8 years ago

rafaelrinaldi commented 8 years ago

Having previously visited stories marked as read would be nice. Maybe a symbol or even through text decoration should do it.

erickbelfy commented 8 years ago

Let me ask you something, i can't see any flags or variables which control the visited items, do you think if we can implement a key named visited:boolean which controls the behaviour of each entry?

erickbelfy commented 8 years ago

Another idea is on keypress event, we may change text of the selected node. Maybe it should work, but i have a concern if user add the option --keep-alive, when the display update, we may lose all visited entries.

rafaelrinaldi commented 8 years ago

@erickbelfy Yeah, we currently have no way to tell what item was previously visited but I was thinking about a flag on the cache object or even an array with the id of visited items. Not sure. Just keep in mind that the data should be immutable and we should try to avoid local state at all costs. Object.assign() can be our friend :+1:

Also, the feature should behave the same either or not the user runs the program with --keep-open.

I also am not sure about the UI. As I said, maybe a bullet or even a text underline should do it. We shouldn't rely on colors though, since I want to support non xterm-256 users as well.

rafaelrinaldi commented 8 years ago

@erickbelfy Also, we can even add a feature to persist read items in the future :bulb:

erickbelfy commented 8 years ago

Hey @rafaelrinaldi I would like to ask you something, you've mentioned about avoid local state at all costs, and use the cache object to store the visited items, do you think about use a package , like node-cache or you suggest use the cache API