Better handling of SHA arguments in CLI show command

This fixes #394 but I don't have time to add functional tests right now.
@volaya can you review and add a functional test if it doesn't seem too complicated?