# TWAPI example
# Show the services that the specified service depends on
# Usage example: tclsh showservicedependencies.example SERVICENAME

package require twapi

if {$argc != 1} {
    puts stderr "Usage: [info nameofexecutable] $argv0 SERVICENAME"
    exit 1
}

# Convert the service name to the internal name
set svcname [twapi::get_service_internal_name [lindex $argv 0]]

set services [list ]
foreach svc [lindex [twapi::get_service_configuration $svcname -dependencies] 1] {
    lappend services [twapi::get_service_display_name $svc]
}
puts [join [lsort -dictionary $services] \n]
