diff options
| author | Mike Buland <mike@xagasoft.com> | 2014-11-28 13:45:37 -0700 |
|---|---|---|
| committer | Mike Buland <mike@xagasoft.com> | 2014-11-28 13:45:37 -0700 |
| commit | 9f7cbe624a91008a4cbe47c7b369c5e3f96a4eff (patch) | |
| tree | 561bd5cb20d17c0c5e5289763d140e42cdde8a3f /src/options.cpp | |
| parent | 02573826558bd44f0ec3ed542964be0096d5e389 (diff) | |
| download | clic-9f7cbe624a91008a4cbe47c7b369c5e3f96a4eff.tar.gz clic-9f7cbe624a91008a4cbe47c7b369c5e3f96a4eff.tar.bz2 clic-9f7cbe624a91008a4cbe47c7b369c5e3f96a4eff.tar.xz clic-9f7cbe624a91008a4cbe47c7b369c5e3f96a4eff.zip | |
Division fixes, better config, more tests.0.11
Other minor fixes and options such as --version being added.
Diffstat (limited to 'src/options.cpp')
| -rw-r--r-- | src/options.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/options.cpp b/src/options.cpp index 4d64b22..d9d34fa 100644 --- a/src/options.cpp +++ b/src/options.cpp | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | #include "options.h" | 1 | #include "options.h" |
| 2 | 2 | ||
| 3 | #include "config.h" | ||
| 4 | |||
| 3 | #include "unitnumber.h" | 5 | #include "unitnumber.h" |
| 4 | #include "unitparser.h" | 6 | #include "unitparser.h" |
| 5 | #include "number.h" | 7 | #include "number.h" |
| @@ -34,6 +36,8 @@ Options::Options( int argc, char *argv[] ) : | |||
| 34 | "use all remaining parameters as the equation (you may wish to quote " | 36 | "use all remaining parameters as the equation (you may wish to quote " |
| 35 | "your equation to prevent special characters from being interpreted by " | 37 | "your equation to prevent special characters from being interpreted by " |
| 36 | "your shell)."); | 38 | "your shell)."); |
| 39 | addOption( Bu::slot(this, &Options::version), 'v', "version", | ||
| 40 | "Show the version string ('" CLIC_VERSION_STR "')"); | ||
| 37 | addHelpOption('h', "help", "This help"); | 41 | addHelpOption('h', "help", "This help"); |
| 38 | 42 | ||
| 39 | parse( argc, argv ); | 43 | parse( argc, argv ); |
| @@ -189,9 +193,15 @@ int Options::execute( Bu::StringArray aArgs ) | |||
| 189 | lex.setRadix( iRadix ); | 193 | lex.setRadix( iRadix ); |
| 190 | Parser parser( lex, mbOut ); | 194 | Parser parser( lex, mbOut ); |
| 191 | parser.parse(); | 195 | parser.parse(); |
| 192 | Bu::println( mbOut.getString() ); | 196 | Bu::print( mbOut.getString() ); |
| 193 | exit( 0 ); | 197 | exit( 0 ); |
| 194 | return aArgs.getSize(); | 198 | return aArgs.getSize(); |
| 195 | } | 199 | } |
| 196 | 200 | ||
| 201 | int Options::version( Bu::StringArray aArgs ) | ||
| 202 | { | ||
| 203 | Bu::println( CLIC_VERSION_STR ); | ||
| 204 | exit( 0 ); | ||
| 205 | return 0; | ||
| 206 | } | ||
| 197 | 207 | ||
