<commit_before>require "rubygems"
require "bundler/setup"
require "thor"
require "cli/post"

module CLI
  class BlogCLI < Thor
    desc "new TITLE", "Creates a new blog post with the specfied title."
    def new(title)
      post = Post.new Dir.pwd, title
      post.create!
    end
  end<commit_msg>added read command to start the web app<commit_after>require "rubygems"
require "bundler/setup"
require "thor"
require "cli/post"
require "web/app"

module CLI
  class BlogCLI < Thor
    desc "new TITLE", "Creates a new blog post with the specfied title."
    def new(title)
      post = Post.new Dir.pwd, title
      post.create!
    end

    desc "read [POST]", "Start the webserver and open the browser."
    long_desc <<-EOF
    Start the webserver and open the browser.

    A post can be given in the form of the filename. If given, the specfic post
    will open in the browser.
    EOF
    def read(post = nil)
      m = /\d{3,}/.match(post)
      tail = "/entry/#{m}" if post && m
      Sinatra::Application.run! :port => 4004 do |server|
        system "x-www-browser http://localhost:4004#{tail} &"
      end
    end
  end
{'fraction_non_alphanumeric': 0.10414827890556046, 'fraction_numerical': 0.00794351279788173, 'mean_word_length': 2.78, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3055840', 'n_tokens_mistral': 381, 'n_tokens_neox': 367, 'n_words': 137}