diff options
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 | ||