From 9873efabfba0bfa0bccc745dbc9eb5749a2022aa Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 18 Jun 2013 20:37:58 +0200 Subject: m MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/argparser.bash | 5 +++-- src/argparser.c | 38 ++++++++++++++++++++++++++++++++++++++ src/argparser.py | 1 + 3 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 src/argparser.c (limited to 'src') diff --git a/src/argparser.bash b/src/argparser.bash index b50e859..ba9529c 100644 --- a/src/argparser.bash +++ b/src/argparser.bash @@ -326,7 +326,7 @@ function args_add_variadic # Prints a colourful help message -function help +function args_help { local dash first last maxfirstlen=0 i=0 n help start count lines=() lens=() local empty=" " line l col index=0 colour @@ -455,13 +455,14 @@ function help # # @param $@:(str) The command line arguments, should exclude the execute file # @exit Whether no unrecognised option is used -function parse +function args_parse { local nulqueue=() argqueue=() optqueue=() queue=() opt arg _arg argnull local dashed=0 tmpdashed=0 get=0 dontget=0 rc=0 i n more std sign type args_argcount=$# args_unrecognised_count=0 + args_arguments=( "$@" ) while [ ! $# = 0 ]; do while [ ! $# = 0 ]; do diff --git a/src/argparser.c b/src/argparser.c new file mode 100644 index 0000000..a3020d6 --- /dev/null +++ b/src/argparser.c @@ -0,0 +1,38 @@ +/** + * argparser – command line argument parser library + * + * Copyright © 2013 Mattias Andrée (maandree@member.fsf.org) + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this library. If not, see . + */ +#include +#include + + +long args_linuxvt; +char* args_program; +char* args_dscription; +char* args_usage; +char* args_longdscription; + + +extern void args_init(char* dscription, char* usage, char* longdscription, char* program, long usestderr) +{ + char* term = getenv("TERM"); + +args_dscription; +args_usage; +args_longdscription; +} + diff --git a/src/argparser.py b/src/argparser.py index b58f89f..a89dada 100644 --- a/src/argparser.py +++ b/src/argparser.py @@ -184,6 +184,7 @@ class ArgParser(): @return :bool Whether no unrecognised option is used ''' self.argcount = len(argv) - 1 + self.arguments = argv[1:] self.files = [] argqueue = [] -- cgit v1.2.3-70-g09d2