<commit_before>#
# Usage:
#
# class SomeCommand < Command; end
# cli = SomeCommand.new [arg1, arg2, ...]
# cli.init
# cli.run
#

module SocialSnippet

  module CommandLine

    class Command

      attr_reader :args
      attr_reader :tokens
      attr_reader :options
      attr_reader :opt_parser

      def initialize(new_args)
        @args = new_args.clone
        @options = {}
        @tokens = [] # init after parse options
        @opt_parser = OptionParser.new
      end

      def define_options
        raise "not implement"
      end

      def set_default_options
        raise "not implement"
      end

      def init
        define_options
        opt_parser.parse! line_options
        @tokens = extract_tokens
        set_default_options
      end

      def run<commit_msg>command: support input<commit_after>#
# Usage:
#
# class SomeCommand < Command; end
# cli = SomeCommand.new [arg1, arg2, ...]
# cli.init
# cli.run
#

module SocialSnippet

  module CommandLine

    class Command

      attr_reader :args
      attr_reader :tokens
      attr_reader :options
      attr_reader :opt_parser
      attr_reader :input

      def initialize(new_args, input = "")
        @args = new_args.clone
        @options = {}
        @tokens = [] # init after parse options
        @opt_parser = OptionParser.new
        @input = input
      end

      def define_options
        raise "not implement"
      end

      def set_default_options
        raise "not implement"
      end

      def init
        define_options
        opt_parser.parse! line_options
        @tokens = extract_tokens
        set_default_options
      end

      def run
{'fraction_non_alphanumeric': 0.07009063444108761, 'fraction_numerical': 0.002416918429003021, 'mean_word_length': 2.0274223034734917, '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': '6975442', 'n_tokens_mistral': 492, 'n_tokens_neox': 473, 'n_words': 130}