| 1 | # Copyright (c) 2008, Christopher Cowart and contributors |
|---|
| 2 | # All rights reserved. |
|---|
| 3 | # |
|---|
| 4 | # Redistribution and use in source and binary forms, with or without |
|---|
| 5 | # modification, are permitted provided that the following conditions |
|---|
| 6 | # are met: |
|---|
| 7 | # * Redistributions of source code must retain the above copyright |
|---|
| 8 | # notice, this list of conditions and the following disclaimer. |
|---|
| 9 | # * Redistributions in binary form must reproduce the above copyright |
|---|
| 10 | # notice, this list of conditions and the following disclaimer in the |
|---|
| 11 | # documentation and/or other materials provided with the distribution. |
|---|
| 12 | # |
|---|
| 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|---|
| 14 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|---|
| 15 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|---|
| 16 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|---|
| 17 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|---|
| 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED |
|---|
| 19 | # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|---|
| 20 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|---|
| 21 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|---|
| 22 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|---|
| 23 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 24 | # |
|---|
| 25 | # $Id$ |
|---|
| 26 | # |
|---|
| 27 | # This is a confman shell library that provides usage and help information. |
|---|
| 28 | # I wanted to get it out of the main script, cause it's really long. This also |
|---|
| 29 | # makes modularizing the code (think foreign languages) in the future. |
|---|
| 30 | |
|---|
| 31 | function print_usage { |
|---|
| 32 | cat <<EOF |
|---|
| 33 | $MYNAME configures confman |
|---|
| 34 | |
|---|
| 35 | Usage: |
|---|
| 36 | $MYNAME [ help | -h ] [ command ] |
|---|
| 37 | $MYNAME setup |
|---|
| 38 | |
|---|
| 39 | For specific information on a particular $MYNAME subcommand, please run |
|---|
| 40 | $MYNAME help subcommand |
|---|
| 41 | |
|---|
| 42 | eg: $MYNAME help rollback |
|---|
| 43 | |
|---|
| 44 | EOF |
|---|
| 45 | |
|---|
| 46 | conf_cleanExit $1 |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | function print_help { |
|---|
| 50 | [ -z "$1" ] && print_usage 0 |
|---|
| 51 | |
|---|
| 52 | case $1 in |
|---|
| 53 | se* ) |
|---|
| 54 | cat <<EOF |
|---|
| 55 | $MYNAME manages configuration files |
|---|
| 56 | |
|---|
| 57 | Usage: |
|---|
| 58 | $MYNAME setup |
|---|
| 59 | |
|---|
| 60 | The setup command can be used to initialize a subversion repository for |
|---|
| 61 | use by confman. Be sure to read the instructions in confadmin(8). |
|---|
| 62 | |
|---|
| 63 | EOF |
|---|
| 64 | ;; |
|---|
| 65 | * ) |
|---|
| 66 | print_usage 1 |
|---|
| 67 | ;; |
|---|
| 68 | esac |
|---|
| 69 | return 0 |
|---|
| 70 | } |
|---|