Skip to content
  • Ethan Sommer's avatar
    libmakepkg: add optional argument support to parseopts · 7be75523
    Ethan Sommer authored and Allan McRae's avatar Allan McRae committed
    
    
    Adds a "?" suffix that can be used to indicate that an option's argument is
    optional.
    
    This allows options to have a default behaviour when the user doesn't
    specify one, e.g.: --color=[when] being able to behave like --color=auto
    when only --color is passed
    
    Options with optional arguments given on the command line will be returned
    in the form "--opt=optarg" and "-o=optarg". Despite that not being the
    syntax for passing an argument with a shortopt (trying to pass -o=foo
    would make -o's argument "=foo"), this is done to allow the caller to split
    the option and its optarg easily
    
    Signed-off-by: default avatarEthan Sommer <e5ten.arch@gmail.com>
    Reviewed-by: default avatarDave Reisner <dreisner@archlinux.org>
    Signed-off-by: default avatarAllan McRae <allan@archlinux.org>
    7be75523