blob: b859509f81a54761250b109bb4c47aaf777e2b00 (
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
56
|
#!/usr/bin/bash -e
set -e
set -o pipefail
case "$0" in
[^/]* ) PATH=$(realpath -e "$(dirname "$BASH_SOURCE")"):$PATH ;;
esac
. rpc.bash
our_main()
{
REMOTE_DEST=localhost
main2 "$@"
main1 "$@"
}
main1()
{
remote_run_function fudge "$@"
}
main2()
{
funcs=$(find_local_only_functions "$@" </dev/null | xargs)
[ ! "$funcs" ] || printf 'Local-only functions (main2): %s\n' "$funcs" >&2
}
find_local_only_functions()
{
intersection <(extract_words < "$BASH_SOURCE") \
<(difference <(all_commands) \
<(remote_run_function all_commands))
}
all_commands()
{
: main2
compgen -A command | sort -u
}
gudge()
{
echo "Hello, ${REPLY@Q}."
topic=${*@Q}
echo "Don't argue with me about ${topic:-punctuation}."
}
fudge()
{
read -p 'Name? ' && gudge "$@"
exit
}
our_main "$@"
|