<commit_before>#!/usr/bin/tclsh
# Traverse through all ports running the supplied target.  If target is
# "index" then just print some useful information about each port.

package require darwinports
dportinit
package require Pextlib

global target

proc port_traverse {func {dir .}} {
    set pwd [pwd]
    if [catch {cd $dir} err] {
	ui_error $err
	return
    }
    foreach name [readdir .] {
	if {[string match $name .] || [string match $name ..]} {
	    continue
	}
	if [file isdirectory $name] {
	    port_traverse $func $name
	} else {
	    if [string match $name Portfile] {
		catch {eval $func {[file join $pwd $dir]}}
	    }
	}
    }
    cd $pwd
}

proc pindex {portdir} {
    global target
    set interp [dportopen $portdir]
    array set portinfo [dportinfo $interp]
    puts "Building port: $portinfo(portname)"
    dportexec $interp $target
    dportclose $interp
}

if { $argc < 1 } {
    set target build
} else {
    set target [lindex $argv 0]<commit_msg>Fix message to print proper action<commit_after>#!/usr/bin/tclsh
# Traverse through all ports running the supplied target.  If target is
# "index" then just print some useful information about each port.

package require darwinports
dportinit
package require Pextlib

global target

proc port_traverse {func {dir .}} {
    set pwd [pwd]
    if [catch {cd $dir} err] {
	ui_error $err
	return
    }
    foreach name [readdir .] {
	if {[string match $name .] || [string match $name ..]} {
	    continue
	}
	if [file isdirectory $name] {
	    port_traverse $func $name
	} else {
	    if [string match $name Portfile] {
		catch {eval $func {[file join $pwd $dir]}}
	    }
	}
    }
    cd $pwd
}

proc pindex {portdir} {
    global target
    set interp [dportopen $portdir]
    array set portinfo [dportinfo $interp]
    puts "Doing $target for port: $portinfo(portname)"
    dportexec $interp $target
    dportclose $interp
}

if { $argc < 1 } {
    set target build
} else {
    set target [lindex $argv 0]
{'fraction_non_alphanumeric': 0.10576923076923077, 'fraction_numerical': 0.0020242914979757085, 'mean_word_length': 3.0020242914979756, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1030719', 'n_tokens_mistral': 690, 'n_tokens_neox': 676, 'n_words': 234}