<commit_before>require 'pathname'
require 'optparse'

require_relative "beastie/version"
require_relative "beastie/issue"

module Beastie

  # tell option parser to accept an existing directory
  OptionParser.accept(Pathname) do |pn|
    Pathname.new(pn) if pn
    raise OptionParser::InvalidArgument, pn if not Dir.exist?(pn)
  end

  # Bestie manages issues from the command line.
  # Each issue is a text file in YAML, whose name is Jekyll-post like: DATE-TITLE.yml
  #
  # Two simple commands
  # - beastie new (create a new issue in the current directory
  # - beastie list (list relevant firelds of issues stored in the current directory)

  class Runner
    # the editor to use with the edit command
    EDITOR = "emacsclient"
    
    def self.run(args)

      # options = {}

      # global_options = OptionParser.new do |opts|
      #   opts.banner = "Usage: beastie [global options] <command> [[command options] <args>]"
        
      #   # Mandatory argument.
      #   opts.on("-d", "--directory DIR", Pathname,
      #           "Use DIR as the directory to store (and retrieve) issues") do |dir|
      #     options[:dir] = dir
      #   end
      # end

      # global_options.order!
      command = args[0]
      args.shift

      case command

      when "new"
        if args != nil 
          puts "beastie error: too many arguments."
          help
          exit 1
        end

        issue = Issue.new
        issue.ask
        issue.save

      when "edit"
        if args.size != 1
          puts "beastie error: please specify an issue."
          help
          exit 1<commit_msg>fixed issue when checking args with new<commit_after>require 'pathname'
require 'optparse'

require_relative "beastie/version"
require_relative "beastie/issue"

module Beastie

  # tell option parser to accept an existing directory
  OptionParser.accept(Pathname) do |pn|
    Pathname.new(pn) if pn
    raise OptionParser::InvalidArgument, pn if not Dir.exist?(pn)
  end

  # Bestie manages issues from the command line.
  # Each issue is a text file in YAML, whose name is Jekyll-post like: DATE-TITLE.yml
  #
  # Two simple commands
  # - beastie new (create a new issue in the current directory
  # - beastie list (list relevant firelds of issues stored in the current directory)

  class Runner
    # the editor to use with the edit command
    EDITOR = "emacsclient"
    
    def self.run(args)

      # options = {}

      # global_options = OptionParser.new do |opts|
      #   opts.banner = "Usage: beastie [global options] <command> [[command options] <args>]"
        
      #   # Mandatory argument.
      #   opts.on("-d", "--directory DIR", Pathname,
      #           "Use DIR as the directory to store (and retrieve) issues") do |dir|
      #     options[:dir] = dir
      #   end
      # end

      # global_options.order!
      command = args[0]
      args.shift

      case command

      when "new"
        if args.size != 0
          puts "beastie error: too many arguments."
          help
          exit 1
        end

        issue = Issue.new
        issue.ask
        issue.save

      when "edit"
        if args.size != 1
          puts "beastie error: please specify an issue."
          help
          exit 1
{'fraction_non_alphanumeric': 0.08471965495995071, 'fraction_numerical': 0.0027726432532347504, 'mean_word_length': 2.1554907677356656, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5061363', 'n_tokens_mistral': 979, 'n_tokens_neox': 944, 'n_words': 339}