~fredg/NuTyX

cc0f7443994c17565037063648df242554198d53 — alienus 8 years ago 85d6e4e
all good but not --help & --version
1 files changed, 25 insertions(+), 18 deletions(-)

M pkgdir.sh
M pkgdir.sh => pkgdir.sh +25 -18
@@ 8,9 8,13 @@
# LICENSE: MIT
#


# pkgdir version
VERSION=0.1


#
#

print_help()
{
    echo "Usage: pkgdir [options] Dir"


@@ 63,7 67,7 @@ build(){
# NuTyX Pkgfile (http://nutyx.org)
EOF

    echo "$PORT/Pkgfile created"
    echo "$PORT/Pkgfile default created"
}

pkg_python()


@@ 81,7 85,7 @@ build() {
# NuTyX Pkgfile (http://nutyx.org)
EOF

    echo "$PORT/Pkgfile created"
    echo "$PORT/Pkgfile python created"
}

pkg_perl()


@@ 106,7 110,7 @@ build() {
# NuTyX Pkgfile (http://nutyx.org)
EOF

    echo "$PORT/Pkgfile created"
    echo "$PORT/Pkgfile perl created"
}

pkg_waf()


@@ 126,7 130,7 @@ build() {
# NuTyX Pkgfile (http://nutyx.org)
EOF

    echo "$PORT/Pkgfile created"
    echo "$PORT/Pkgfile waf created"
}

pkg_info()


@@ 154,22 158,22 @@ parse_options()
        case $1 in
            -d|--default)
                DIR=$2
                DEFAULT=1 ;;
                DEFAULT=YES ;;
            -py|--python)
                DIR=$2
                PYTHON=1 ;;
                PYTHON=YES ;;
            -p|--perl)
                DIR=$2
                PERL=1 ;;
                PERL=YES ;;
            -w|--waf)
                DIR=$2
                WAF=1 ;;
                WAF=YES ;;
            -v|--version)
                VERSION=1 ;;
                VERSION=YES ;;
            -h|--help)
                HELP=1 ;;
                HELP=YES ;;
             *)
                 die "Invalid option, see pkgdir --help, aborting!"
                 die "Invalid option, see pkgdir --help, aborting!" ;;
         esac
    else
        die "Invalid option, see pkgdir --help, aborting!"


@@ 180,22 184,25 @@ main()
{
    parse_options "$@"

    if [ DEFAULT ]; then
    if [ $DEFAULT ]; then
        check_dir
        pkg_default
        pkg_info    
    elif [ PERL ]; then
    elif [ $PERL ]; then
        check_dir
        pkg_perl
    elif [ PYTHON ]; then
        pkg_info
    elif [ $PYTHON ]; then
        check_dir
        pkg_python
    elif [ WAF ]; then
        pkg_info
    elif [ $WAF ]; then
        check_dir
        pkg_waf
    elif [ VERSION ]; then
        pkg_info
    elif [ $VERSION ]; then
        die "pkgdir $VERSION"
    elif [ HELP ]; then
    elif [ $HELP ]; then
        print_help
    else
        die "Wrong option, see pkgdir --help !"