forked from Samsung/ONE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nncc
executable file
·43 lines (33 loc) · 805 Bytes
/
nncc
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
#!/bin/bash
NNCC_SCRIPT_RPATH="scripts"
NNCC_COMMAND_RPATH="infra/nncc/command"
NNCC_PROJECT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NNCC_SCRIPT_PATH="${NNCC_PROJECT_PATH}/${NNCC_SCRIPT_RPATH}"
function Usage()
{
echo "Usage: $0 [COMMAND] ..."
echo "Command:"
for file in "$NNCC_COMMAND_RPATH"/*;
do
echo " $(basename "$file")"
done
}
# Get command from command-line
COMMAND=$1; shift
if [[ -z "${COMMAND}" ]]; then
Usage
exit 255
fi
COMMAND_FILE="${NNCC_PROJECT_PATH}/${NNCC_COMMAND_RPATH}/${COMMAND}"
if [[ ! -f "${COMMAND_FILE}" ]]; then
echo "ERROR: '${COMMAND}' is not supported"
Usage
exit 255
fi
export NNCC_PROJECT_PATH
export NNCC_SCRIPT_PATH
function import()
{
source "${NNCC_PROJECT_PATH}/infra/nncc/config/$1"
}
source "${COMMAND_FILE}" "$@"