blob: 6a24eca8bf49e5919f8a1fd9c38ba4728e6eddb4 (
plain)
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
|
#!/usr/bin/env bash
# Level-2 wrapper to be able to
#
# nix-script channel <command>
source $(dirname ${BASH_SOURCE[0]})/nix-utils.sh
export VERBOSE
usage() {
cat <<EOS >&2
$(help_synopsis "${BASH_SOURCE[0]}" "[-h] [-l] <command>")
-l List all available commands
-h Show this help and exit
$(help_end "channel")
EOS
}
while getopts "hl" OPTION
do
case $OPTION in
h)
usage
exit 0
;;
l)
caller_util_list_subcommands_for "nix-script-channel"
exit 0
;;
*)
;;
esac
done
if [[ -z "$1" ]]
then
# no command available
stderr "No command given"
usage
exit 1
fi
SCRIPT=$(caller_util_get_script "nix-script-channel" "$1")
[[ -z "$SCRIPT" ]] && exit 1
stdout "SCRIPT = $SCRIPT"
stdout "Parsing args for '$1'"
SCRIPT_ARGS=$(echo $* | sed -r "s/(.*)$1(.*)/\2/")
stdout "Calling: '$SCRIPT $SCRIPT_ARGS'"
RC_CONFIG=$RC_CONFIG RC_NIXPKGS=$RC_NIXPKGS exec bash $SCRIPT $SCRIPT_ARGS
|