Some functions are called and set automatically when you call ‘cpt-lib’, so you shouldn’t define the option parser after calling the library, as some of the variables will already be set.
If the function ‘parser_definition()’ as defined when ‘cpt-lib’ is called, cpt-lib will handle the option parsing itself by calling ‘getoptions’ inside. Here is the proper way of doing it.
#!/bin/sh -e parser_definition() { # The rest arguments MUST be defined as 'REST' setup REST help:usage -- "usage: ${0##*/} [options] [pkg...]" msg -- '' 'Options:' flag CPT_TEST -t export:1 init:@export -- "Enable tests" global_options } . cpt-lib