diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-06-18 20:37:58 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-06-18 20:37:58 +0200 |
commit | 9873efabfba0bfa0bccc745dbc9eb5749a2022aa (patch) | |
tree | e6d853baa90fdb42aa69bf19e88b28bf5a87a72e | |
parent | complete bash version (diff) | |
download | argparser-9873efabfba0bfa0bccc745dbc9eb5749a2022aa.tar.gz argparser-9873efabfba0bfa0bccc745dbc9eb5749a2022aa.tar.bz2 argparser-9873efabfba0bfa0bccc745dbc9eb5749a2022aa.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/argparser.bash | 5 | ||||
-rw-r--r-- | src/argparser.c | 38 | ||||
-rw-r--r-- | src/argparser.py | 1 |
3 files changed, 42 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>. + */ +#include <stdlib.h> +#include <stdio.h> + + +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 = [] |