-
Notifications
You must be signed in to change notification settings - Fork 0
/
mulle-objc-printline
executable file
·133 lines (99 loc) · 2.39 KB
/
mulle-objc-printline
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#! /usr/bin/env mulle-bash
#
# Look through libraries and find a name for the given
# uniqueid. Searches classes and methods at the moment.
#
MULLE_EXECUTABLE_VERSION=0.9.1
usage()
{
cat <<EOF >&2
Usage:
${MULLE_USAGE_NAME} [options] <class>
Print a class-coverage.csv line for a class or category. If you also specify
a method with -m then a method-coverage.csv line will be printed.
Options:
--method <name> : specify method
--category <name> : specify category
EOF
options_technical_flags_usage | sort >&2
exit 1
}
main()
{
local LIB_PATH
local OPTION_SELECTOR="NO"
while [ $# -ne 0 ]
do
if options_technical_flags "$1"
then
shift
continue
fi
# your option handling
case "$1" in
--version)
echo "${MULLE_EXECUTABLE_VERSION}"
exit 0
;;
-c|--category)
[ $# -eq 1 ] && fail "missing argument to $1"
shift
CATEGORY="$1"
;;
-m|--method)
[ $# -eq 1 ] && fail "missing argument to $1"
shift
METHOD="$1"
;;
-h|--help)
usage
;;
-*)
fail "unknown option $1"
;;
*)
break
;;
esac
shift
done
options_setup_trace "${MULLE_TRACE}" && set -x
local uniqueid
[ $# -ne 1 ] && usage
CLASS="$1"
# prefer sibling mulle-objc-lista
if [ -z "${MULLE_OBJC_UNIQUEID}" ]
then
MULLE_OBJC_UNIQUEID="${0%/*}/mulle-objc-uniqueid"
if [ ! -x "${MULLE_OBJC_UNIQUEID}" ]
then
MULLE_OBJC_UNIQUEID="`command -v mulle-objc-uniqueid`"
[ -z "${MULLE_OBJC_UNIQUEID}" ] && fail "mulle-objc-uniqueid not in PATH"
fi
fi
CLASSID="`"${MULLE_OBJC_UNIQUEID}" "${CLASS}"`"
if [ ! -z "${CATEGORY}" ]
then
CATEGORYID="`"${MULLE_OBJC_UNIQUEID}" "${CATEGORY}"`"
fi
if [ -z "${METHOD}" ]
then
echo "${CLASSID};${CLASS};${CATEGORYID};${CATEGORY}"
return 0
fi
case "${METHOD}" in
-*)
PREFIX="-"
;;
+*)
PREFIX="+"
;;
*)
fail "Method must have - or + prefix"
;;
esac
METHOD="${METHOD:1:${#METHOD}-1}"
METHODID="`"${MULLE_OBJC_UNIQUEID}" "${METHOD}"`"
echo "${CLASSID};${CLASS};${CATEGORYID};${CATEGORY};${METHODID};${PREFIX}${METHOD}"
}
main "$@"