#! /usr/bin/env tclsh

package require cmdline

set options {
    {myarg      "myarg"}
    {my2secret  "my2secret"}
    {h          "Print help"}
}

if {[catch {array set arg [::cmdline::getoptions argv $options]}]} {
    puts stderr "Error: Unknown option: [lindex $argv 0]"
    puts -nonewline [::cmdline::usage $options]
    exit 1
}

puts "options list is:\n$options"
puts "Processed arguments:"
parray arg

if {$arg(h)} {
    puts {}
    puts -nonewline [::cmdline::usage $options]
    exit 0
}
