rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.11k stars 552 forks source link

Fix dashless option usage info #800

Closed sambostock closed 1 year ago

sambostock commented 1 year ago

🌈

When option aliases are specified without dashes

option :from, aliases: [:f]

they are correctly handled when parsing the command

my_cli hello -f Loki Thor
from: Loki
Hello Thor

However the usage information does not include the dash. This PR fixes that by moving alias normalization to happen sooner, so it applies to both the usage information generator and the actual command:

 my_cli help hello  
 Usage:
   my_cli hello NAME

 Options:
-  f, [--from=FROM]  
+  -f, [--from=FROM]  

 say hello to NAME