#!/bin/bash
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8

function display_help() {
    uecho "$scriptname: Copier les librairies ulib et/ou pyulib

USAGE
    $scriptname [options] destdir

OPTIONS
    -u
        Copier ulib
    -p
        Copier pyulib"
}

source "$(dirname "$0")/ulib/ulib" &&
urequire DEFAULTS ||
exit 1

parse_opts "${PRETTYOPTS[@]}" \
    --help '$exit_with display_help' \
    -u,--ulib ulib \
    -p,--pyulib pyulib \
    @ args -- "$@" && set -- "${args[@]}" || die "$args"

[ -z "$ulib" -a -z "$pyulib" ] && ulib=1

destdir="${1:-.}"
if [ -n "$ulib" ]; then
    if ask_yesno "Voulez-vous copier les librairies ulib dans $(ppath "$destdir")?" O; then
        ulib_sync "$destdir"
    fi
fi
if [ -n "$pyulib" ]; then
    if ask_yesno "Voulez-vous copier les librairies pyulib dans $(ppath "$destdir")?" O; then
        urequire nutools/pyulib
        pyulib_sync "$destdir"
    fi
fi