Fw: tcl puzzle for cygwin tcl'ers SOLVED
Jim McNamara
jmcnamara10001@proton.me
Sat Aug 31 10:14:09 GMT 2024
Hi-
with AI I got this solution to fly.
sorry for the confusion. I wasnt breaking it into steps and then expanding it in eval. I also fixed my display issues.
thanks so much,
have coolest day.
jim
#!/usr/bin/env wish
package require Tk
# Function to dynamically build and execute a command
proc execute_docker_cp {} {
set container_id "dde8bab92d8cd55efa7946bc0184c23e3f1f3c7e6d0f070fd45f0a7f2ebd4932"
set container_path "/home/masterblasterx1001/foo/xyz"
set local_path "c:/Users/stealth_droid"
# Construct the Docker cp command dynamically
set docker_command "\"$container_id:$container_path\" \"$local_path\""
# Output the command for debugging purposes
# puts "Executing command: $docker_command"
# Execute the Docker command using exec
try {
# Store the command and its arguments in a list
set docker_command [list "docker" "cp" "$container_id:$container_path" "$local_path"]
# Execute the command and capture its output
# Print the output
set output [exec {*}$docker_command]
} on error {msg} {
puts "Output of '[join $docker_command " "]':"
tk_messageBox -message $msg
}
}
# Create GUI
proc create_gui {} {
global top
set top [toplevel .t]
wm title $top "Docker Command Executor"
# Create and pack the button
button $top.execute -text "Execute Docker Command" -command execute_docker_cp
pack $top.execute -padx 10 -pady 10
# Start the Tk event loop
tkwait window $top
}
# Main script
create_gui
More information about the Cygwin
mailing list