summaryrefslogtreecommitdiff
path: root/src/rpc.main.bash
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-08-27 11:55:32 -0400
committerAndrew Cady <d@jerkface.net>2023-08-27 11:55:32 -0400
commit17e91005ccedc355cb213fda0cbbe674a847ea85 (patch)
tree49644eff7c5d88ea9e84e1ad530688a03d54c595 /src/rpc.main.bash
parentb01d26fcc596f46f20207f17636331f7916bb0ac (diff)
YES
Diffstat (limited to 'src/rpc.main.bash')
-rw-r--r--src/rpc.main.bash47
1 files changed, 5 insertions, 42 deletions
diff --git a/src/rpc.main.bash b/src/rpc.main.bash
index c34296e..21dc071 100644
--- a/src/rpc.main.bash
+++ b/src/rpc.main.bash
@@ -1,46 +1,10 @@
1#!/usr/bin/bash -e 1#!/bin/bash
2set -e 2set -e
3set -o pipefail 3set -o pipefail
4
5case "$0" in 4case "$0" in
6 [^/]* ) PATH=$(realpath -e "$(dirname "$BASH_SOURCE")"):$PATH ;; 5 [^/]* ) PATH=$(realpath -e "$(dirname "$BASH_SOURCE")"):$PATH ;;
7esac 6esac
8 7source rpc.bash
9. rpc.bash
10
11our_main()
12{
13 REMOTE_DEST=localhost
14# main2 "$@"
15 main1 "$@"
16}
17
18main1()
19{
20 # local -a BASH_RPC_SSH_OPTIONS=('-4' '-6' '-4')
21 with_ssh_options -4 -6 -4 -- \
22 remote_run_function fudge "$@"
23}
24
25main2()
26{
27 funcs=$(find_local_only_functions "$@" </dev/null | xargs)
28 [ ! "$funcs" ] || printf 'Local-only functions (main2): %s\n' "$funcs" >&2
29}
30
31find_local_only_functions()
32{
33 remote_commands=($(remote_run_function all_commands | sort -u))
34 intersection <(extract_words < "$BASH_SOURCE") \
35 <(difference <(all_commands) \
36 <(printf '%s\n' "${remote_commands[@]}"))
37}
38
39all_commands()
40{
41 : main2
42 compgen -A command | sort -u
43}
44 8
45gudge() 9gudge()
46{ 10{
@@ -48,12 +12,11 @@ gudge()
48 topic=${*@Q} 12 topic=${*@Q}
49 echo "Don't argue with me about ${topic:-punctuation}." 13 echo "Don't argue with me about ${topic:-punctuation}."
50} 14}
51
52fudge() 15fudge()
53{ 16{
54 read -p "[$(hostname)] Name? " && gudge "$@" 17 read -p "[$(hostname)] Name? " && gudge "$@"
55 exit 18 exit
56} 19}
57 20with_ssh_options -4 -- \
58our_main "$@" 21 remote_run_function \
59 22 fudge "$@"