2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 function cli_help_requested
() {
25 if [ -n "${argument}" ]; then
26 if listmatch
${argument} help -h --help; then
34 function cli_status_headline
() {
37 local state
="${COLOUR_DOWN}DOWN${COLOUR_NORMAL}"
38 zone_is_up
${zone} && state="${COLOUR_UP}UP${COLOUR_NORMAL}"
40 echo -e "${zone} - ${state} - $(zone_get_hook ${zone})"
43 function cli_headline() {
45 echo -e "${COLOUR_BOLD}$@
${COLOUR_NORMAL}"
48 function cli_yesno() {
49 local message="$@
[y
/n
] "
57 if listmatch ${yesno} y Y yes YES Yes; then
61 elif listmatch ${yesno} n N no NO No; then
67 function cli_get_key() {
72 function cli_get_val() {
76 function cli_usage() {
78 local basename="$
(basename ${0})"
80 if ! isset command; then
81 command="${basename} help"
84 echo "The given
command was not understood by
${basename}.
" >&2
85 echo "Please run
'${command}' for detailed
help.
" >&2
88 function cli_show_man() {
92 if ! binary_exists man; then
93 error "The man package is not installed on this system.
"
94 error "Please
install 'man' in order to view the
help.
"