rvesse / airline

Java annotation-based framework for parsing Git like command line structures with deep extensibility
https://rvesse.github.io/airline/
Apache License 2.0
128 stars 20 forks source link

Support abbreviated numbers as command line input #54

Closed rvesse closed 7 years ago

rvesse commented 7 years ago

Currently options and arguments which have integer numeric types rely on those types parsing methods which require numeric values to be stated in full. When a command expects to receive large numerical values this can be very error prone for end users. Therefore it would be nice if it was possible to configure Airline such that abbreviated forms would be accepted e.g. 25M would translate to 25000000

This can be done by extending the existing type converter and overriding the portion that deals with converting simple types. As with most things we probably want to make this configurable both in terms of what suffixes are acceptable and how they are interpreted. Therefore the following implementation is suggested:

rvesse commented 7 years ago

A nice to have but more complex extension would be to allow specific options to have specific converters that allow you to mix different abbreviation formats in a single command

Another extension would be to support stating numeric values in other common formats such as octal and hexadecimal

rvesse commented 7 years ago

This is now mostly implemented, mainly needs more test cases to check the overriding works as Designed