~aleteoryx/tclfeed-bsky

ref: 192de7f4eac1c5ffec850501a66dcdeb2e765c25 tclfeed-bsky/src/at.tcl -rw-r--r-- 486 bytes
192de7f4Aleteoryx readme tweaks 28 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
namespace eval at {
  # conformant enough, i hope
  proc uri {uri} {
    if {[string first "at://" $uri] != 0} return
    set uri [string range $uri 5 end]
    set uri [split $uri /]

    switch -- [llength $uri] {
      1 { return [list authority [lindex $uri 0]] }
      2 { return [list authority [lindex $uri 0] collection [lindex $uri 1]] }
      3 { return [list authority [lindex $uri 0] collection [lindex $uri 1] rkey [lindex $uri 2]] }
      default { return {} }
    }
  }
}