<commit_before>#!/usr/bin/env swiftly

// Example file for swiftly

import Foundation

println("example.swift: running")

var index = 0
for argument in Process.arguments {
    println("example.swift argument [\(index)]: \(argument)")
    index++
}

// Handle STDIN.
func input() -> String {
    let keyboard = NSFileHandle.fileHandleWithStandardInput()
    let inputData = keyboard.availableData
    let inputString = NSString(data: inputData, encoding:NSUTF8StringEncoding)
    let trimmedString = inputString!.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet())
    return trimmedString
}


if Process.arguments[1] == "-stdin" {
    println(input())
}<commit_msg>Getting example.swift program name from executable name<commit_after>#!/usr/bin/env swiftly

// Example file for swiftly

import Foundation

var arguments = Process.arguments
// Get program name
let programName = arguments[0].lastPathComponent
// Remove program name from argument list
arguments.removeAtIndex(0)

println("\(programName): running")

var index = 0
for argument in Process.arguments {
    println("\(programName) argument [\(index)]: \(argument)")
    index++
}

// Handle STDIN.
func input() -> String {
    let keyboard = NSFileHandle.fileHandleWithStandardInput()
    let inputData = keyboard.availableData
    let inputString = NSString(data: inputData, encoding:NSUTF8StringEncoding)
    let trimmedString = inputString!.stringByTrimmingCharactersInSet(NSCharacterSet.newlineCharacterSet())
    return trimmedString
}


if Process.arguments[1] == "-stdin" {
    println(input())
}
{'fraction_non_alphanumeric': 0.11118130132659507, 'fraction_numerical': 0.00505369551484523, 'mean_word_length': 4.739130434782608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '291962', 'n_tokens_mistral': 465, 'n_tokens_neox': 433, 'n_words': 116}