RocHack / bb

Command line Blackboard client
MIT License
72 stars 8 forks source link

'bb announcements' displays all announcements when specified course is not found #28

Open AstralSorcerer opened 9 years ago

AstralSorcerer commented 9 years ago

I'm not sure if this is a bug or a feature, but having my terminal spammed with every BlackBoard announcement I've ever recieved is not optimal, IMHO.

clehner commented 9 years ago

Possible solutions:

  1. auto pipe through pager if there is a lot of output (like how git does it)
  2. limit to last N announcements, with option to change N
  3. reverse order of announcements so that the most recent are left visible in terminal at the end
AstralSorcerer commented 9 years ago

Personally, I think it would be best to display an error message and exit without printing any announcements.

joeljk13 commented 9 years ago

On the bright side, this means that implementing the 'get announcements for all courses' feature will be extremely easy.


Note that there's really 2 problems here:

  1. specifying a course that doesn't exist prints announcements for all courses.
  2. bb announcements outputs too much

For problem 1, I'd say it's probably best to display an error message. For problem 2, I think all of clehner's options would work well.

For option 1: git doesn't pipe to a pager only if there's a lot of output. Commands like git log always pipe to the pager (unless you do git --no-pager log). The pager might exit immediately if the output is short enough though. Git lets the user specify their pager; we'd probably just want an argument --pager or --no-pager, and then choose one as the default (I'd vote for --pager as the default personally).

Another possible option: limit to announcements since a user specified date, or within a user-specified number of days back. This will probably be more useful than option 2 but more difficult to implement.

clehner commented 9 years ago

Commands like git log always pipe to the pager (unless you do git --no-pager log). The pager might exit immediately if the output is short enough though.

Good point, I didn't realize that. I agree then that piping through the pager always would be a good idea. (Probably also for grades and others too).

For announcements, I think it would also help readability to make the output more compact by removing blank lines within each posting (e.g. between the Posted by/to/on and the title)

AstralSorcerer commented 9 years ago

+1 pager. As another extention to option 2, I'd like the ability to see only new (unread) announcements, but this might be extremely hard to implement.

joeljk13 commented 9 years ago

The unread announcements is very similar to my idea of limiting by date - if bb stored the last date it got announcements for a course, then it could just limit by that date by default.