<commit_before>def add_tag_flag(cmd)
  cmd.desc 'Docker tag for application container'
  cmd.arg_name 'TAG'
  cmd.flag [:tag]
end

def add_target_flag(cmd)
  cmd.desc 'Deployment target to use, e.g. production_web'
  cmd.arg_name 'TARGET'
  cmd.flag [:t, :target], type: Symbol, required: true
end

def add_instance_flag(cmd)
  cmd.desc '0-based index into the array of running instances'
  cmd.default_value 0
  cmd.arg_name 'INSTANCE'
  cmd.flag [:n, :instance], type: Fixnum
end

desc 'Bootstrap your service and task definition from the configured definition.'
command :bootstrap do |bootstrap|
  add_tag_flag(bootstrap)
  add_target_flag(bootstrap)

  bootstrap.action do |_, options, _|
    Broadside::Command.bootstrap(options)
  end
end

desc 'Gives an overview of the deploy targets'
command :targets do |targets|
  targets.action do |_, options, _|
    Broadside::Command.targets(options)
  end
end

desc 'Gets information about what is currently deployed.'
command :status do |status|
  add_target_flag(status)

  status.action do |_, options, _|
    Broadside::Command.status(options)
  end
end

desc 'Creates a single instance of the application to run a command.'
command :run do |run|
  run.desc 'Broadside::Command to run (wrap argument in quotes)'
  run.arg_name 'COMMAND'
  run.flag [:command], type: Array

  add_tag_flag(run)
  add_instance_flag(run)
  add_target_flag(run)

  run.action do |_, options, _|
    Broadside::Command.run(options)
  end
end

desc 'Tail the logs inside a running container.'
command :logtail do |logtail|
  logtail.desc 'Number of lines to tail'
  logtail.default_value 10
  logtail.arg_name 'TAIL_LINES'
  logtail.flag [:l, :lines], type: Fixnum

  add_instance_flag(logtail)
  add_target_flag(logtail)

  logtail.action do |_, options, _|
    Broadside::Command.logtail(options)
  end
end

desc 'Establish a secure shell on an instance running the container.'
command :ssh do |ssh|
  add_instance_flag(ssh)
  add_target_flag(ssh)

  ssh.action do |_, options, _|
    Broadside::Command.ssh(options)
  end
end

desc 'Establish a shell inside a running container.'
command :bash do |bash|
  add_instance_flag(bash)
  add_target_flag(bash)

  bash.action do |_, options, _|
    Broadside::Command.bash(options)
  end
end

desc 'Deploy your application.'
command :deploy do |d|
  d.desc 'Deploys WITHOUT running predeploy commands'
  d.command :short do |short|
    add_tag_flag(full)
    add_target_flag(short)

    short.action do |_, options, _|
      Broadside::Command.deploy_short(options)
    end
  end

  d.desc 'Deploys WITH running predeploy commands'<commit_msg>Add the tag to :short (fix typo bug)<commit_after>def add_tag_flag(cmd)
  cmd.desc 'Docker tag for application container'
  cmd.arg_name 'TAG'
  cmd.flag [:tag]
end

def add_target_flag(cmd)
  cmd.desc 'Deployment target to use, e.g. production_web'
  cmd.arg_name 'TARGET'
  cmd.flag [:t, :target], type: Symbol, required: true
end

def add_instance_flag(cmd)
  cmd.desc '0-based index into the array of running instances'
  cmd.default_value 0
  cmd.arg_name 'INSTANCE'
  cmd.flag [:n, :instance], type: Fixnum
end

desc 'Bootstrap your service and task definition from the configured definition.'
command :bootstrap do |bootstrap|
  add_tag_flag(bootstrap)
  add_target_flag(bootstrap)

  bootstrap.action do |_, options, _|
    Broadside::Command.bootstrap(options)
  end
end

desc 'Gives an overview of the deploy targets'
command :targets do |targets|
  targets.action do |_, options, _|
    Broadside::Command.targets(options)
  end
end

desc 'Gets information about what is currently deployed.'
command :status do |status|
  add_target_flag(status)

  status.action do |_, options, _|
    Broadside::Command.status(options)
  end
end

desc 'Creates a single instance of the application to run a command.'
command :run do |run|
  run.desc 'Broadside::Command to run (wrap argument in quotes)'
  run.arg_name 'COMMAND'
  run.flag [:command], type: Array

  add_tag_flag(run)
  add_instance_flag(run)
  add_target_flag(run)

  run.action do |_, options, _|
    Broadside::Command.run(options)
  end
end

desc 'Tail the logs inside a running container.'
command :logtail do |logtail|
  logtail.desc 'Number of lines to tail'
  logtail.default_value 10
  logtail.arg_name 'TAIL_LINES'
  logtail.flag [:l, :lines], type: Fixnum

  add_instance_flag(logtail)
  add_target_flag(logtail)

  logtail.action do |_, options, _|
    Broadside::Command.logtail(options)
  end
end

desc 'Establish a secure shell on an instance running the container.'
command :ssh do |ssh|
  add_instance_flag(ssh)
  add_target_flag(ssh)

  ssh.action do |_, options, _|
    Broadside::Command.ssh(options)
  end
end

desc 'Establish a shell inside a running container.'
command :bash do |bash|
  add_instance_flag(bash)
  add_target_flag(bash)

  bash.action do |_, options, _|
    Broadside::Command.bash(options)
  end
end

desc 'Deploy your application.'
command :deploy do |d|
  d.desc 'Deploys WITHOUT running predeploy commands'
  d.command :short do |short|
    add_tag_flag(short)
    add_target_flag(short)

    short.action do |_, options, _|
      Broadside::Command.deploy_short(options)
    end
  end

  d.desc 'Deploys WITH running predeploy commands'
{'fraction_non_alphanumeric': 0.09559103002660585, 'fraction_numerical': 0.0015203344735841885, 'mean_word_length': 4.3594704684317716, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5087848', 'n_tokens_mistral': 1796, 'n_tokens_neox': 1740, 'n_words': 530}