This release makes the utility much nicer to use by reducing the size of tarcels and improving the error reporting from tarcel.tarcel. It also corrects a bug that meant that the args variable couldn’t be used as effectively as possible within a .tarcel called using the tarcel command from within another .tarcel. Finally this release adds support for specifying a hashbang line.

Proper Handling of args Variable

You can now use the args variable within a .tarcel without having to worry if it isn’t passed as in this case it will be an empty list. This allows you to create a .tarcel such as the following, adapted from a previous article, to package the Tclx module:

set loadCommands [get packageLoadCommands Tclx {*}$args]
lassign $loadCommands loadCommand version
set outputFilename "Tclx-$"
set baseDir "Tclx-$version.vfs"
set filesLibDir [file join $baseDir tclx$version]

if {[regexp {^load[^;]+$} $loadCommand]} {
  set libFilename [regsub {^(load\s+)(.*?) (.*?)$} $loadCommand {\2}]
  set libDirname [file dirname $libFilename]
  set tclxFilenames [glob -tails -directory $libDirname *.so *.tcl]

  foreach filename $tclxFilenames {
    fetch $filesLibDir \
          [file join $libDirname $filename]
} else {
  error "Can't find package: Tclx"

set initScript {
  lappend auto_path [file normalize @baseDir]
  load [file join @filesLibDir @libTailFilename] Tclx

config set init [string map [list @baseDir $baseDir \
                                  @filesLibDir $filesLibDir \
                                  @libTailFilename [file tail $libFilename]] \

config set outputFilename $outputFilename

From the calling .tarcel you can choose to restrict the version numbers of Tclx:

tarcel modules [file join tarcels tclx.tarcel 8.3-8.5]

or you can call it without specifying the version requirements and it will use the latest:

tarcel modules [file join tarcels tclx.tarcel]

Adding a Hashbang Line

So that you can make a script executable within Unix you can now specify a hashbang line within an applications .tarcel:

config set hashbang "/usr/bin/env tclsh"