From e53253f9d1e80dd8a9b67befbe604f8bd85f032c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Thu, 20 Aug 2015 16:58:20 -0400 Subject: [PATCH] contrib/objcwrapper: intro basic framework for command line options MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- contrib/objcwrapper/src/objcwrapper.nit | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/contrib/objcwrapper/src/objcwrapper.nit b/contrib/objcwrapper/src/objcwrapper.nit index 3a941ed..d697cf5 100644 --- a/contrib/objcwrapper/src/objcwrapper.nit +++ b/contrib/objcwrapper/src/objcwrapper.nit @@ -15,18 +15,35 @@ # Generator of Nit modules to wrap Objective-C services module objcwrapper +import nitcc_runtime +import opts + import objc_visitor import objc_model import objc_generator - -import nitcc_runtime import objc_lexer import objc_parser +var opt_help = new OptionBool("Show this help message", "-h", "--help") + +var opts = new OptionContext +opts.add_option(opt_help, opt_output) +opts.parse(args) + +if opts.errors.not_empty or opts.rest.is_empty or opt_help.value then + print """ +Usage: objcwrapper [options] input_file [other_input_file [...]] +Options:""" + opts.usage + + if opt_help.value then exit 0 + exit 1 +end + var v = new Interpretor var g = new CodeGenerator -for arg in args do +for arg in opts.rest do # Read input var content = arg.to_path.read_all -- 1.7.9.5