~aleteoryx/tclfeed-bsky

ref: 951aa944b42e9c60684dae9e7355486582f1cff6 tclfeed-bsky/src/at.tcl -rw-r--r-- 486 bytes
951aa944Aleteoryx add lists, make blocker prettier 29 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 {} }
    }
  }
}