Commit Graph

8 Commits

Author SHA1 Message Date
Allan McRae bfd6d22be2 parse_options: accept multiple arguments
Allow command-line options to accept multiple arguments without
additional quoting by taking the list of arguments until one
starting with a "-" is reached.

The only current use of this is the --pkg option in makepkg.  This
allows (e.g.)

makepkg --pkg foo bar

and packages "foo" and "bar" will be built.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:31 -05:00
Allan McRae 87ee38d8b3 parse_options: implement optional arguments
This allows options specified with a trailing "::" to optionally
take arguments.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:25 -05:00
Allan McRae ddb8617d96 parse_options: add missing newlines
Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-07-05 10:22:20 -05:00
Dave Reisner e27a5c8851 parse-options: simplify unused-arg & parameter printing
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-24 00:02:06 -05:00
Allan McRae e27e658033 parse_options: adjust error messages
Provide consistent error messages for unknown long and short options.
Also get full string translation for the messages.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:19:45 -05:00
Allan McRae 53f4e43191 scripts/library: add README file
Add a README file to briefly document the code snippets in the scripts
library folder.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:19:10 -05:00
Allan McRae 4272b37d3d scripts: refactor output formatting functions
Move the common output formatting functions into a separate
library file and import that into each script.  makepkg is
excluded due to its additional color formatting.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:18:05 -05:00
Allan McRae 6f3a2145b0 makepkg: move option parsing code to separate file
This move the getopt replacement function parse_options out of
makepkg.sh.in and into a separate file.  The code is inserted
into the relevant place in makepkg using m4.

This will allow the reuse of the option parsing code in other
scripts (i.e. pacman-key) while avoiding code duplication.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-15 09:16:38 -05:00