summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-06-19 00:42:11 +0000
committerOmar Rizwan <omar@omar.website>2023-06-19 00:44:27 +0000
commitccdd5ad22cef126ed1c5837fc8b8c8ded5eeccd3 (patch)
tree5b27eb100a281f450419e722e7ce93aaaff6cd20
parentFix dot and probably sharing (diff)
downloadfolk-ccdd5ad22cef126ed1c5837fc8b8c8ded5eeccd3.tar.gz
folk-ccdd5ad22cef126ed1c5837fc8b8c8ded5eeccd3.zip
More sharing & dot cleanup/improvement/fixing
-rw-r--r--hosts.tcl49
-rw-r--r--laptop.tcl3
-rw-r--r--lib/evaluator.tcl5
3 files changed, 34 insertions, 23 deletions
diff --git a/hosts.tcl b/hosts.tcl
index 18675971..d5b2e795 100644
--- a/hosts.tcl
+++ b/hosts.tcl
@@ -1,25 +1,36 @@
-set wifi "Fios-LGTS3-5G"
-catch {
- if {$::tcl_platform(os) eq "Darwin"} {
- set wifi [exec sh -c {/Sy*/L*/Priv*/Apple8*/V*/C*/R*/airport -I | sed -n "s/^.*SSID: \(.*\)$/\1/p"}]
- } elseif {$::tcl_platform(os) eq "Linux"} {
- set wifi [exec iwgetid -r]
- }
-}
-
-if {$wifi eq "cynosure"} { set ::shareNode "folk-omar.local" } \
-elseif {$wifi eq "Verizon_TWRHB4"} { set ::shareNode "folk-cwervo.local" } \
-elseif {$wifi eq "WONDERLAND"} { set ::shareNode "folk-haip.local" } \
-elseif {$wifi eq "GETNEAR"} { set ::shareNode "folk-ian.local" } \
-elseif {$wifi eq "Fios-LGTS3-5G" || $wifi eq "Fios-LGTS3"} { set ::shareNode "folk0.local" } \
-elseif {[string match "_onefact.org*" $wifi]} { set ::shareNode "folk-onefact.local" } \
-else { set ::shareNode "folk0.local" }
-
if {[info exists ::env(FOLK_SHARE_NODE)]} {
set ::shareNode $::env(FOLK_SHARE_NODE)
+} else {
+ try {
+ if {$::tcl_platform(os) eq "Darwin"} {
+ set wifi [exec sh -c {/Sy*/L*/Priv*/Apple8*/V*/C*/R*/airport -I | sed -n "s/^.*SSID: \(.*\)$/\1/p"}]
+ } elseif {$::tcl_platform(os) eq "Linux"} {
+ set wifi [exec iwgetid -r]
+ }
+
+ if {$wifi eq "cynosure"} {
+ set ::shareNode "folk-omar.local"
+ } elseif {$wifi eq "Verizon_TWRHB4"} {
+ set ::shareNode "folk-cwervo.local"
+ } elseif {$wifi eq "WONDERLAND"} {
+ set ::shareNode "folk-haip.local"
+ } elseif {$wifi eq "GETNEAR"} {
+ set ::shareNode "folk-ian.local"
+ } elseif {$wifi eq "Fios-LGTS3-5G" || $wifi eq "Fios-LGTS3"} {
+ set ::shareNode "folk0.local"
+ } elseif {[string match "_onefact.org*" $wifi]} {
+ set ::shareNode "folk-onefact.local"
+ } else {
+ # there's no default.
+ }
+ } on error e {
+ set ::shareNode "none"
+ }
}
-if {$::shareNode eq "none"} { unset ::shareNode }
+
+if {[info exists ::shareNode] && $::shareNode eq "none"} { unset ::shareNode }
if {[info exists ::argv] && $::argv eq "shareNode"} {
- puts $::shareNode
+ if {[info exists ::shareNode]} { puts $::shareNode } \
+ else { puts none }
}
diff --git a/laptop.tcl b/laptop.tcl
index 3582f8d7..9a27de02 100644
--- a/laptop.tcl
+++ b/laptop.tcl
@@ -61,6 +61,7 @@ Assert when /program/ has error /err/ with info /info/ {{program err info} {
source "hosts.tcl"
if {[info exists ::shareNode]} {
+ puts "Will try to share with: $::shareNode"
# copy to Pi
if {[catch {
# TODO: forward entry point
@@ -69,7 +70,7 @@ if {[info exists ::shareNode]} {
exec -ignorestderr ssh folk@$::shareNode -- sudo systemctl restart folk >@stdout &
} err]} {
puts "error syncing: $err"
- puts "Proceeding without sharing to table."
+ puts "Proceeding without sharing."
} else {
source "lib/peer.tcl"
diff --git a/lib/evaluator.tcl b/lib/evaluator.tcl
index 98a37054..119855ce 100644
--- a/lib/evaluator.tcl
+++ b/lib/evaluator.tcl
@@ -692,16 +692,15 @@ namespace eval Statements { ;# singleton Statement store
dict for {matchId _} [statement parentMatchIds $stmt] {
set parents [lmap edge [matchEdges $matchId] {expr {
- [dict get $edge type] == 1 ? "<[dict get $edge statement]>" : [continue]
+ [dict get $edge type] == 1 ? "[dict get $edge statement]" : [continue]
}}]
- lappend dot "<$matchId> \[label=\"<$matchId> <- $parents\"\];"
+ lappend dot "<$matchId> \[label=\"$matchId <- $parents\"\];"
lappend dot "<$matchId> -> <$id>;"
}
lappend dot "}"
dict for {childMatchId _} [statement childMatchIds $stmt] {
- set childMatchId [string map {: _} $childMatchId]
lappend dot "<$id> -> <$childMatchId>;"
}
}