<commit_before>require 'columnize'
require 'forwardable'
require_relative 'helper'

module Byebug

  module CommandFunctions
    #
    # Pad a string with dots at the end to fit :width setting
    #
    def pad_with_dots(string)
      if string.size > Command.settings[:width]
        string[Command.settings[:width]-3 .. -1] = "..."
      end
    end
  end

  class Command
    Subcmd = Struct.new(:name, :min, :short_help, :long_help)

    class << self
      def commands
        @commands ||= []
      end

      DEF_OPTIONS = { allow_in_control:     false,
                      allow_in_post_mortem: true ,
                      event:                true ,
                      always_run:           0    ,
                      unknown:              false,
                      need_context:         false } unless defined?(DEF_OPTIONS)

      def help(args)
        output = description.gsub(/^ +/, '')

        if defined? self::Subcommands
          return output += format_subcmds unless args and args[1]
          output += format_subcmd(args[1])
        end

        return output
      end

      def find(subcmds, param)
        param.downcase!
        for try_subcmd in subcmds do
          if (param.size >= try_subcmd.min) and
              (try_subcmd.name[0..param.size-1] == param)
            return try_subcmd
          end<commit_msg>Output format<commit_after>require 'columnize'
require 'forwardable'
require_relative 'helper'

module Byebug

  module CommandFunctions
    #
    # Pad a string with dots at the end to fit :width setting
    #
    def pad_with_dots(string)
      if string.size > Command.settings[:width]
        string[Command.settings[:width]-3 .. -1] = "..."
      end
    end
  end

  class Command
    Subcmd = Struct.new(:name, :min, :short_help, :long_help)

    class << self
      def commands
        @commands ||= []
      end

      DEF_OPTIONS = { allow_in_control:     false,
                      allow_in_post_mortem: true ,
                      event:                true ,
                      always_run:           0    ,
                      unknown:              false,
                      need_context:         false } unless defined?(DEF_OPTIONS)

      def help(args)
        output = description.gsub(/^ +/, '') + "\n"

        if defined? self::Subcommands
          return output += format_subcmds unless args and args[1]
          output += format_subcmd(args[1])
        end

        return output
      end

      def find(subcmds, param)
        param.downcase!
        for try_subcmd in subcmds do
          if (param.size >= try_subcmd.min) and
              (try_subcmd.name[0..param.size-1] == param)
            return try_subcmd
          end
{'fraction_non_alphanumeric': 0.09014290949065591, 'fraction_numerical': 0.005130084279956028, 'mean_word_length': 1.5779036827195467, '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': '3909830', 'n_tokens_mistral': 786, 'n_tokens_neox': 753, 'n_words': 197}