wcarhart / koi

Bashful argument parsing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot source koi scripts

wcarhart opened this issue · comments

When running koi scripts, currently cannot run scripts with source. Seems like the issue is in __parseargs. Here's an example:

Source:

#!/bin/bash
set -e
source koi
koiname=set_env.sh
koidescription="Set up a virtualenv"
function __koimain {
    __addarg "-h" "--help" "help" "optional" "" "set up virtualenv"
    __addarg "" "environment" "positionalvalue" "required" "" "name of environmental variable"
    __parseargs "$@"
    echo "$environment"
    source "./Documents/virtualenvs/${environment}/bin/activate"
    cd "Documents/${environment}"
}
__koirun "$@"

Running it:

source set_env.sh --help
__action=help
__action=positionalvalue
__parseargs:51: bad substitution
[Process completed]