1# -*- tcl -*- 2# Implementation of 'validate'. 3 4# Available variables 5# * argv - Cmdline arguments 6# * base - Location of sak.tcl = Top directory of Tcllib distribution 7# * cbase - Location of all files relevant to this command. 8# * sbase - Location of all files supporting the SAK. 9 10package require sak::util 11package require sak::validate 12 13set raw 0 14set log 0 15set stem {} 16set tclv {} 17 18if {[llength $argv]} { 19 # First argument may be a command. 20 set cmd [lindex $argv 0] 21 if {![catch { 22 package require sak::validate::$cmd 23 } msg]} { 24 set argv [lrange $argv 1 end] 25 } else { 26 set cmd all 27 } 28 29 # Now process any possible options (-v, -l, --log). 30 31 while {[string match -* [set opt [lindex $argv 0]]]} { 32 switch -exact -- $opt { 33 -v { 34 set raw 1 35 set argv [lrange $argv 1 end] 36 } 37 -l - --log { 38 set log 1 39 set stem [lindex $argv 1] 40 set argv [lrange $argv 2 end] 41 } 42 -t - --tcl { 43 set tclv [lindex $argv 1] 44 set argv [lrange $argv 2 end] 45 } 46 default { 47 sak::validate::usage Unknown option "\"$opt\"" 48 } 49 } 50 } 51} else { 52 set cmd all 53} 54 55# At last now handle all remaining arguments as module specifications. 56if {![sak::util::checkModules argv]} return 57 58if {$log} { set raw 0 } 59 60array set mode { 61 00 short 62 01 log 63 10 verbose 64 11 _impossible_ 65} 66 67sak::validate::$cmd $argv $mode($raw$log) $stem $tclv 68 69## 70# ### 71