~ubuntu-branches/ubuntu/trusty/giarpfanoa/trusty

« back to all changes in this revision

Viewing changes to src/parse-args.func

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2003-07-11 12:08:43 UTC
  • Revision ID: james.westby@ubuntu.com-20030711120843-kekc8bw6snqz72c4
Tags: 0.1.1
* Fixed module loading.
* Added config to install target.
* Various other bugfixes so that the tool is really useful.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# This file needs display-usage.func and display-version.func to be loaded
 
3
# before this file.
 
4
#
 
5
 
 
6
pre_parse_args() {
 
7
    while [ $# -gt 0 ] ; do
 
8
        case "$1" in
 
9
            --help)
 
10
                display_usage
 
11
                exit 0
 
12
                ;;
 
13
            --module)
 
14
                # NOP
 
15
                shift 2
 
16
                ;;
 
17
            --list*)
 
18
                shift
 
19
                ;;
 
20
            --config)
 
21
                CONFIGFILES="$2"
 
22
                shift
 
23
                ;;
 
24
            --version)
 
25
                display_version
 
26
                exit 0
 
27
                ;;
 
28
            --*)
 
29
                echo "ERROR: Unknown option $1."
 
30
                display_usage
 
31
                exit 1
 
32
                ;;
 
33
            *)
 
34
                shift
 
35
                ;;
 
36
        esac
 
37
    done
 
38
}
 
39
 
 
40
parse_args() {
 
41
    while [ $# -gt 0 ] ; do
 
42
        case "$1" in
 
43
            --help)
 
44
                # NOP
 
45
                shift
 
46
                ;;
 
47
            --module)
 
48
                MODULES="$MODULES "$(echo "$2" | tr ',' ' ')
 
49
                shift 2
 
50
                ;;
 
51
            --list*)
 
52
                list_modules
 
53
                exit 0
 
54
                ;;
 
55
            --config)
 
56
                # NOP
 
57
                shift
 
58
                ;;
 
59
            --version)
 
60
                # NOP
 
61
                shift
 
62
                ;;
 
63
            --*)
 
64
                # NOP
 
65
                shift
 
66
                ;;
 
67
            *)
 
68
                TARGETS="$TARGETS $1"
 
69
                shift
 
70
                ;;
 
71
        esac
 
72
    done
 
73
}