<commit_before>require 'thor'

module Tugboat
  autoload :Middleware, "tugboat/middleware"

  class CLI < Thor
    include Thor::Actions
    ENV['THOR_COLUMNS'] = '120'

    !check_unknown_options

    map "--version" => :version, "-v" => :version

    desc "help [COMMAND]", "Describe commands or a specific command"
    def help(meth=nil)
      super
      if !meth
        say "To learn more or to contribute, please see github.com/pearkes/tugboat"
      end
    end

    desc "authorize", "Authorize a DigitalOcean account with tugboat"
    long_desc "This takes you through a workflow for adding configuration
    details to tugboat. First, you are asked for your API and Client keys,
    which are stored in ~/.tugboat.

    You can retrieve your credentials from digitalocean.com/api_access.

    Optionally, you can configure the default SSH key path and username
    used for `tugboat ssh`. These default to '~/.ssh/id_rsa' and the
    $USER environment variable.
    "
    def authorize
      Middleware.sequence_authorize.call({})
    end

    desc "droplets", "Retrieve a list of your droplets"
    def droplets
      Middleware.sequence_list_droplets.call({})
    end

    desc "images", "Retrieve a list of your images"
    method_option "global",
                  :type => :boolean,
                  :default => false,
                  :aliases => "-g",
                  :desc => "Show global images"
    def images
      Middleware.sequence_list_images.call({
        "user_show_global_images" => options[:global],
        })
    end

    desc "ssh FUZZY_NAME", "SSH into a droplet"
    method_option "id",
                  :type => :string,
                  :aliases => "-i",
                  :desc => "The ID of the droplet."
    method_option "name",
                  :type => :string,
                  :aliases => "-n",
                  :desc => "The exact name of the droplet"
    method_option "ssh_port",
                  :type => :string,
                  :aliases => "-p",
                  :desc => "The custom SSH Port to connect to"
    method_option "ssh_user",
                  :type => :string,
                  :aliases => "-u",
                  :desc => "Specifies which user to log in as"
    method_option "ssh_opts",
                  :type => :string,
                  :aliases => "-o",
                  :desc => "Custom SSH options"
    def ssh(name=nil)
      Middleware.sequence_ssh_droplet.call({
        "user_droplet_id" => options[:id],
        "user_droplet_name" => options[:name],
        "user_droplet_fuzzy_name" => name,
        "user_droplet_ssh_port" => options[:ssh_port],
        "user_droplet_ssh_user" => options[:ssh_user],
        "user_droplet_ssh_opts" => options[:ssh_opts]
      })
    end

    desc "create NAME", "Create a droplet."
    method_option  "size",
                   :type => :numeric,
                   :aliases => "-s",
                   :default => 64,
                   :desc => "The size_id of the droplet"
    method_option  "image",
                   :type => :numeric,
                   :aliases => "-i",
                   :default => 2676,
                   :desc => "The image_id of the droplet"
    method_option  "region",
                   :type => :numeric,
                   :aliases => "-r",
                   :default => 1,
                   :desc => "The region_id of the droplet"
    method_option  "keys",
                   :type => :string,
                   :aliases => "-k",
                   :desc => "A comma separated list of SSH key ids to add to the droplet"
    def create(name)
      Middleware.sequence_create_droplet.call({
        "create_droplet_size_id" => options[:size],
        "create_droplet_image_id" => options[:image],
        "create_droplet_region_id" => options[:region],<commit_msg>Update the defaults for droplet creation<commit_after>require 'thor'

module Tugboat
  autoload :Middleware, "tugboat/middleware"

  class CLI < Thor
    include Thor::Actions
    ENV['THOR_COLUMNS'] = '120'

    !check_unknown_options

    map "--version" => :version, "-v" => :version

    desc "help [COMMAND]", "Describe commands or a specific command"
    def help(meth=nil)
      super
      if !meth
        say "To learn more or to contribute, please see github.com/pearkes/tugboat"
      end
    end

    desc "authorize", "Authorize a DigitalOcean account with tugboat"
    long_desc "This takes you through a workflow for adding configuration
    details to tugboat. First, you are asked for your API and Client keys,
    which are stored in ~/.tugboat.

    You can retrieve your credentials from digitalocean.com/api_access.

    Optionally, you can configure the default SSH key path and username
    used for `tugboat ssh`. These default to '~/.ssh/id_rsa' and the
    $USER environment variable.
    "
    def authorize
      Middleware.sequence_authorize.call({})
    end

    desc "droplets", "Retrieve a list of your droplets"
    def droplets
      Middleware.sequence_list_droplets.call({})
    end

    desc "images", "Retrieve a list of your images"
    method_option "global",
                  :type => :boolean,
                  :default => false,
                  :aliases => "-g",
                  :desc => "Show global images"
    def images
      Middleware.sequence_list_images.call({
        "user_show_global_images" => options[:global],
        })
    end

    desc "ssh FUZZY_NAME", "SSH into a droplet"
    method_option "id",
                  :type => :string,
                  :aliases => "-i",
                  :desc => "The ID of the droplet."
    method_option "name",
                  :type => :string,
                  :aliases => "-n",
                  :desc => "The exact name of the droplet"
    method_option "ssh_port",
                  :type => :string,
                  :aliases => "-p",
                  :desc => "The custom SSH Port to connect to"
    method_option "ssh_user",
                  :type => :string,
                  :aliases => "-u",
                  :desc => "Specifies which user to log in as"
    method_option "ssh_opts",
                  :type => :string,
                  :aliases => "-o",
                  :desc => "Custom SSH options"
    def ssh(name=nil)
      Middleware.sequence_ssh_droplet.call({
        "user_droplet_id" => options[:id],
        "user_droplet_name" => options[:name],
        "user_droplet_fuzzy_name" => name,
        "user_droplet_ssh_port" => options[:ssh_port],
        "user_droplet_ssh_user" => options[:ssh_user],
        "user_droplet_ssh_opts" => options[:ssh_opts]
      })
    end

    desc "create NAME", "Create a droplet."
    method_option  "size",
                   :type => :numeric,
                   :aliases => "-s",
                   :default => 66,
                   :desc => "The size_id of the droplet"
    method_option  "image",
                   :type => :numeric,
                   :aliases => "-i",
                   :default => 284203,
                   :desc => "The image_id of the droplet"
    method_option  "region",
                   :type => :numeric,
                   :aliases => "-r",
                   :default => 1,
                   :desc => "The region_id of the droplet"
    method_option  "keys",
                   :type => :string,
                   :aliases => "-k",
                   :desc => "A comma separated list of SSH key ids to add to the droplet"
    def create(name)
      Middleware.sequence_create_droplet.call({
        "create_droplet_size_id" => options[:size],
        "create_droplet_image_id" => options[:image],
        "create_droplet_region_id" => options[:region],
{'fraction_non_alphanumeric': 0.11115439553304765, 'fraction_numerical': 0.0028567718478119727, 'mean_word_length': 1.8212454212454212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 95, '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': '721984', 'n_tokens_mistral': 2309, 'n_tokens_neox': 2119, 'n_words': 640}