Files
rap/lib/msg
T

59 lines
1.3 KiB
Bash

#!/bin/bash
#
# lib/msg
#
# Copyright (c) 2011-2013 LibreVPN <vpn@hackcoop.com.ar>
#
# See AUTHORS for a list of contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Affero General
# Public License along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
#
# La base para todos los mensajes, se imprime en stderr
msg() {
msg="$1"; shift
printf "> $msg\n" $@ 1>&2
}
error() {
msg="$(gettext "$1")"; shift
msg "$(gettext "ERROR:") ${msg}" $@
}
warning() {
msg="$(gettext "$1")"; shift
msg "$(gettext "ALERTA:") ${msg}" $@
}
# Mensaje de error y salir
fatal_error() {
msg="$(gettext "$1")"; shift
error "${msg}" $@
exit 1
}
# Sugerir algo
tip() {
msg="$(gettext "$1")"; shift
msg "Tip: ${msg}" $@
}
# Muestra el manual
# $1 el comando para obtener la ayuda
help() {
man $1 || man ${LVPN_DIR}/doc/es/$1.1
}