#!/usr/local/bin/tclsh8.6

package require ctable_client

if {[llength $argv] < 2} {
  puts "Usage: $argv0 sttp_url sttp_command ?args...?"
}

set cmd [lassign $argv url]
remote_ctable $url _remote

set status [catch [concat _remote $cmd] response]

if {$status} {
  puts stderr $response
} else {
  puts $response
}

_remote destroy

exit $status
