<commit_before>require 'bond/m'
require 'bond/version'
require 'bond/readline'
require 'bond/rawline'
require 'bond/agent'
require 'bond/search'
require 'bond/input'
require 'bond/rc'
require 'bond/mission'
require 'bond/missions/default_mission'
require 'bond/missions/method_mission'
require 'bond/missions/object_mission'
require 'bond/missions/anywhere_mission'
require 'bond/missions/operator_method_mission'

module Bond
  extend self

  # Defines a completion rule (Mission). A valid Mission consists of a condition and an action. A
  # condition is specified with one of the following options: :on, :object, :anywhere or :method(s). Each
  # of these options creates a different Mission class. An action is either this method's block or :action.
  # An action takes what the user has typed (Input) and returns an array of possible completions. Bond
  # searches these completions and returns matching completions. This searching behavior can be configured
  # or turned off per mission with :search. If turned off, the action must also handle searching.
  # ====Options:
  # [*:on*] Regular expression which matches the full line of input to create a Mission object.
  # [*:method*, *:methods*, *:class*] See MethodMission.
  # [*:anywhere*, *:prefix*] See AnywhereMission.
  # [*:object*] See ObjectMission.
  # [*:search*] A symbol or false which determines how completions are searched. Defaults to :default_search
  #             value in Bond.config. If false, search is turned off and assumed to be done in the action.
  #             Possible symbols are :anywhere, :ignore_case, :underscore, :default. See Search for more.
  # [*:action*] Rc method name that takes an Input and returns possible completions. See MethodMission for
  #             specific behavior with :method(s).
  # [*:place*] A number or :last which indicates where a mission is inserted amongst existing missions.
  #            If the symbol :last, places the mission at the end regardless of missions defined after
  #            it. Multiple declarations of :last are kept last in the order they are defined.
  # [*:name*] A symbol or string that serves a unique id for a mission. This unique id can be passed by
  #           Bond.recomplete to identify and replace the mission.
  # ==== Examples:
  #  Bond.complete(:method=>'shoot') {|input| %w{to kill} }
  #  Bond.complete(:on=>/^((([a-z][^:.\(]*)+):)+/, :search=>false) {|input| Object.constants.grep(/#{input.matched[1]}/) }
  #  Bond.complete(:object=>ActiveRecord::Base, :search=>:underscore, :place=>:last)
  #  Bond.complete(:method=>'you', :search=>proc {|input, list| list.grep(/#{input}/i)} ) {|input| %w{Only Live Twice} }
  #  Bond.complete(:method=>'system', :action=>:shell_commands)
  def complete(*args, &block); M.complete(*args, &block); end

  # Redefines an existing completion mission. Takes same options as Bond.complete.
  # ==== Example:
  #   Bond.recomplete(:on=>/man/, :name=>:count) { %w{4 5 6}}
  def recomplete(*args, &block); M.recomplete(*args, &block); end

  # Reports what completion mission matches for a given input. Helpful for debugging missions.
  # ==== Example:
  #   >> Bond.spy "shoot oct"
  #   Matches completion mission for method matching "shoot".
  #   Possible completions: ["octopussy"]
  def spy(*args); M.spy(*args); end

  # Global config with the following keys:
  # [*:readline_plugin*] Specifies a Bond plugin to interface with a Readline-like library. Available
  #                      plugins are Readline and Rawline. Defaults to Readline.
  # [*:default_mission*] A proc or name of an Rc method to use as the default completion when no
  #                      missions match.
  # [*:default_search*] Name of a *_search method in Rc to use as the default search in completions.
  #                     Default is :underscore. See Bond.complete's :search option for valid values.
  # [*:eval_binding*] Specifies a binding to use when evaluating objects in ObjectMission and MethodMission.
  #                   When in irb, defaults to irb's current binding. Otherwise defaults to TOPLEVEL_BINDING.
  # [*:debug*]  Boolean to show the stacktrace when autocompletion fails. Default is false.
  def config; M.config; end

  # Starts Bond with a default set of completions that replace and improve irb's completion. Loads completion
  # files in the following order: lib/bond/completion.rb, optional ~/.bondrc, lib/bond/completions/*.rb,
  # optional ~/.bond/completions/*.rb and optional block. See Rc for the DSL to use in completion files and
  # in the block. See Bond.config for valid options.
  # ==== Example:
  #   Bond.start(:default_search=>:ignore_case) do
  #     complete(:method=>"Object#respond_to?") {|e| e.object.methods }
  #   end
  def start(options={}, &block); M.start(options, &block); end

  # The agent handling all the completion missions.
  def agent; M.agent; end
end<commit_msg>shortcut Bond.list_methods<commit_after>require 'bond/m'
require 'bond/version'
require 'bond/readline'
require 'bond/rawline'
require 'bond/agent'
require 'bond/search'
require 'bond/input'
require 'bond/rc'
require 'bond/mission'
require 'bond/missions/default_mission'
require 'bond/missions/method_mission'
require 'bond/missions/object_mission'
require 'bond/missions/anywhere_mission'
require 'bond/missions/operator_method_mission'

module Bond
  extend self

  # Defines a completion rule (Mission). A valid Mission consists of a condition and an action. A
  # condition is specified with one of the following options: :on, :object, :anywhere or :method(s). Each
  # of these options creates a different Mission class. An action is either this method's block or :action.
  # An action takes what the user has typed (Input) and returns an array of possible completions. Bond
  # searches these completions and returns matching completions. This searching behavior can be configured
  # or turned off per mission with :search. If turned off, the action must also handle searching.
  # ====Options:
  # [*:on*] Regular expression which matches the full line of input to create a Mission object.
  # [*:method*, *:methods*, *:class*] See MethodMission.
  # [*:anywhere*, *:prefix*] See AnywhereMission.
  # [*:object*] See ObjectMission.
  # [*:search*] A symbol or false which determines how completions are searched. Defaults to :default_search
  #             value in Bond.config. If false, search is turned off and assumed to be done in the action.
  #             Possible symbols are :anywhere, :ignore_case, :underscore, :default. See Search for more.
  # [*:action*] Rc method name that takes an Input and returns possible completions. See MethodMission for
  #             specific behavior with :method(s).
  # [*:place*] A number or :last which indicates where a mission is inserted amongst existing missions.
  #            If the symbol :last, places the mission at the end regardless of missions defined after
  #            it. Multiple declarations of :last are kept last in the order they are defined.
  # [*:name*] A symbol or string that serves a unique id for a mission. This unique id can be passed by
  #           Bond.recomplete to identify and replace the mission.
  # ==== Examples:
  #  Bond.complete(:method=>'shoot') {|input| %w{to kill} }
  #  Bond.complete(:on=>/^((([a-z][^:.\(]*)+):)+/, :search=>false) {|input| Object.constants.grep(/#{input.matched[1]}/) }
  #  Bond.complete(:object=>ActiveRecord::Base, :search=>:underscore, :place=>:last)
  #  Bond.complete(:method=>'you', :search=>proc {|input, list| list.grep(/#{input}/i)} ) {|input| %w{Only Live Twice} }
  #  Bond.complete(:method=>'system', :action=>:shell_commands)
  def complete(*args, &block); M.complete(*args, &block); end

  # Redefines an existing completion mission. Takes same options as Bond.complete.
  # ==== Example:
  #   Bond.recomplete(:on=>/man/, :name=>:count) { %w{4 5 6}}
  def recomplete(*args, &block); M.recomplete(*args, &block); end

  # Reports what completion mission matches for a given input. Helpful for debugging missions.
  # ==== Example:
  #   >> Bond.spy "shoot oct"
  #   Matches completion mission for method matching "shoot".
  #   Possible completions: ["octopussy"]
  def spy(*args); M.spy(*args); end

  # Global config with the following keys:
  # [*:readline_plugin*] Specifies a Bond plugin to interface with a Readline-like library. Available
  #                      plugins are Readline and Rawline. Defaults to Readline.
  # [*:default_mission*] A proc or name of an Rc method to use as the default completion when no
  #                      missions match.
  # [*:default_search*] Name of a *_search method in Rc to use as the default search in completions.
  #                     Default is :underscore. See Bond.complete's :search option for valid values.
  # [*:eval_binding*] Specifies a binding to use when evaluating objects in ObjectMission and MethodMission.
  #                   When in irb, defaults to irb's current binding. Otherwise defaults to TOPLEVEL_BINDING.
  # [*:debug*]  Boolean to show the stacktrace when autocompletion fails. Default is false.
  def config; M.config; end

  # Starts Bond with a default set of completions that replace and improve irb's completion. Loads completion
  # files in the following order: lib/bond/completion.rb, optional ~/.bondrc, lib/bond/completions/*.rb,
  # optional ~/.bond/completions/*.rb and optional block. See Rc for the DSL to use in completion files and
  # in the block. See Bond.config for valid options.
  # ==== Example:
  #   Bond.start(:default_search=>:ignore_case) do
  #     complete(:method=>"Object#respond_to?") {|e| e.object.methods }
  #   end
  def start(options={}, &block); M.start(options, &block); end

  # The agent handling all the completion missions.
  def agent; M.agent; end

  # Shortcut to MethodMission.all_methods
  def list_methods; MethodMission.all_methods; end
end
{'fraction_non_alphanumeric': 0.1126448362720403, 'fraction_numerical': 0.0008060453400503779, 'mean_word_length': 3.7583892617449663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 35, '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': '5642199', 'n_tokens_mistral': 2923, 'n_tokens_neox': 2827, 'n_words': 1115}