#!/bin/bash
#########################################################
#                                                       #
# This is BashStyle-NG                                  #
#                                                       #
# Licensed under GNU GENERAL PUBLIC LICENSE v3          #
#                                                       #
# Copyright Christopher Roy Bratušek                    #
#                                                       #
#########################################################

. gettext.sh
export TEXTDOMAIN="bashstyle-rc"

case ${1} in
    --help | -h | "")
        bashstyle-help -a "Christopher Roy Bratusek" -e "nano@jpberlin.de" -h "https://www.nanolx.org/"\
            -l "GNU GPL v3" -n "round" -s "$(eval_gettext "round number")"\
            -v "${BSNG_VERSION}" -y "${BSNG_YEAR}"\
            -o "$(eval_gettext "number:|number to round")"\
            -o "$(eval_gettext "decimal places:|(optional) decimal places [or 0]")"
    ;;

    * )
        if [ -n  "${2}" ]; then
                printf "%.${2}f\n" "${1}"
        else    printf "%.0f\n" "${1}"
        fi
    ;;
esac
