<commit_before># frozen_string_literal: true

module TrySailBlogNotification
  class Cli < Thor

    class_option 'log-level', desc: 'Set the logger level.', type: :string, enum: %w(fatal error warn info debug)

    package_name TrySailBlogNotification::Application::NAME

    no_commands do
      def invoke_command(command, *args)
        app = TrySailBlogNotification::Application.app
        app.log.level = options['log-level'] unless options['log-level'].nil?

        super(command, *args)
      end

      # Call command class.
      #
      # @param [Class] klass Sub class of TrySailBlogNotification::Command::BaseCommand.
      def call_command(klass)
        command = klass.new(options, args)
        command.start
      end
    end

    desc 'start', 'Run trysail-blog-notification.'
    option 'no-notification', desc: 'No send the notification.', type: :boolean, default: false
    def start
      call_command(TrySailBlogNotification::Command::StartCommand)
    end

    desc 'console', 'Start trysail-blog-notification console'
    def console
      call_command(TrySailBlogNotification::Command::ConsoleCommand)<commit_msg>Update Cli class comment.<commit_after># frozen_string_literal: true

module TrySailBlogNotification
  class Cli < Thor

    class_option 'log-level', desc: 'Set the logger level.', type: :string, enum: %w(fatal error warn info debug)

    package_name TrySailBlogNotification::Application::NAME

    no_commands do
      def invoke_command(command, *args)
        app = TrySailBlogNotification::Application.app
        app.log.level = options['log-level'] unless options['log-level'].nil?

        super(command, *args)
      end

      # Call command class.
      #
      # @param klass [Class] Sub class of TrySailBlogNotification::Command::BaseCommand.
      def call_command(klass)
        command = klass.new(options, args)
        command.start
      end
    end

    desc 'start', 'Run trysail-blog-notification.'
    option 'no-notification', desc: 'No send the notification.', type: :boolean, default: false
    def start
      call_command(TrySailBlogNotification::Command::StartCommand)
    end

    desc 'console', 'Start trysail-blog-notification console'
    def console
      call_command(TrySailBlogNotification::Command::ConsoleCommand)
{'fraction_non_alphanumeric': 0.09886759581881534, 'fraction_numerical': 0.0, 'mean_word_length': 3.4951076320939336, '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': '957359', 'n_tokens_mistral': 657, 'n_tokens_neox': 630, 'n_words': 170}