1
2
3
4
5
6
7
8
9
|
1
2
3
4
5
6
7
8
9
|
-
+
|
#!/usr/bin/env tclsh
# KitCreator downloader v0.2.0 -- download Tclkits created with the KitCreator
# KitCreator downloader v0.2.1 -- download Tclkits created with the KitCreator
# Web Interface. Works with Tcl 8.5+ and Jim Tcl v0.75+.
# Copyright (C) 2016, dbohdan.
# License: MIT.
proc download url {
# Guess at what the buildinfo URL might be if we are given, e.g., a building
# page URL.
set url [string map {/building {}} $url]
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
+
|
if {[string index $baseUrl end] ne {/}} {
append baseUrl /
}
set tclkit $baseUrl[dict get $buildInfo filename]
puts "Downloading $tclkit to $filename..."
exec curl -o $filename $tclkit >@ stdout 2>@ stderr
file attributes $filename -permissions +x
}
set url [lindex $argv 0]
if {$url eq {}} {
puts "usage: $argv0 url"
puts {The URL must be a KitCreator Web Interface buildinfo page.}
} else {
download $url
}
|