gabebw / most-used

Find your most-used shell commands
BSD 3-Clause "New" or "Revised" License
12 stars 0 forks source link

Show pretty error if --shell receives a bad option #17

Closed gabebw closed 7 years ago

gabebw commented 7 years ago

The shell function in CLI.hs shows this gross internal error if it receives --shell not_bash_or_zsh:

most-used-exe: --shell can only take 'bash' or 'zsh'
CallStack (from HasCallStack):
  error, called at src/MostUsed/CLI.hs:51:11 in most-used-0.1.0.0-5xJL0L1se38JcakkBKWPOD:MostUsed.CLI

One idea is to add UnsupportedShell to the Shell type and then print an error in Main.hs when the Option type is pulled apart. That's probably the best solution (thanks @gfontenot!).

It's only called directly by most-used-bash and most-used-zsh, though, and the user is unlikely to ever call --shell directly, so this is low priority.