<commit_before>import app, signal from howl
import File from howl.io

tstack = {}

handler = (args) ->
  tstack[#tstack+1] = args.file
  if args.file.basename == '-'
    app.window\remove_view!
    fn = tstack[#tstack-1] or File '.howl-proj'
    file = fn\open!
    app\open_file File '.howl-proj' unless tstack[#tstack-1]
    script = ''
    iscript = false
    for line in file\lines!
      continue if line\gsub("^%s*(.-)%s*$", "%1") == ''
      if iscript
        script ..= line .. '\n'
      elseif line == '!:'
        iscript = true
      else
        app\open_file File line
        app.window\remove_view! if #app.window.views > 1
    app\close_buffer args.buffer
    if script != ''
      f = require('moonscript').loadstring script
      assert f<commit_msg>Register the current directory as a project<commit_after>import app, signal, Project from howl
import File from howl.io

tstack = {}

handler = (args) ->
  tstack[#tstack+1] = args.file
  if args.file.basename == '-'
    app.window\remove_view!
    fn = tstack[#tstack-1] or File '.howl-proj'
    file = fn\open!
    app\open_file File '.howl-proj' unless tstack[#tstack-1]
    table.insert Project.roots, File '.'
    script = ''
    iscript = false
    for line in file\lines!
      continue if line\gsub("^%s*(.-)%s*$", "%1") == ''
      if iscript
        script ..= line .. '\n'
      elseif line == '!:'
        iscript = true
      else
        app\open_file File line
        app.window\remove_view! if #app.window.views > 1
    app\close_buffer args.buffer
    if script != ''
      f = require('moonscript').loadstring script
      assert f
{'fraction_non_alphanumeric': 0.14506172839506173, 'fraction_numerical': 0.006172839506172839, 'mean_word_length': 2.37006237006237, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6659908', 'n_tokens_mistral': 558, 'n_tokens_neox': 552, 'n_words': 141}