Class: Agent::Lock::CLI::Commands::ShowRepo

Inherits:
Show
  • Object
show all
Defined in:
lib/agent/lock/cli/commands/show.rb

Overview

alock show repo [owner/name].

Instance Attribute Summary

Attributes inherited from Base

#launcher

Instance Method Summary collapse

Methods inherited from Show

inherited

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Agent::Lock::CLI::Commands::Base

Instance Method Details

#call(repo: nil, **options) ⇒ void

This method returns an undefined value.

Parameters:

  • repo (String, nil) (defaults to: nil) —

    nil or blank for the checkout this runs in

  • options (Hash) —

    :redis_url

Raises:

  • (Error) —

    when no repository is named and the current directory is in no checkout with an origin remote



153
154
155
156
157
158
# File 'lib/agent/lock/cli/commands/show.rb', line 153

def call(repo: nil, **options)
  repo = Store::RedisIndex.slug_for if repo.to_s.strip.empty?
  locks = index(options).locks(repo)
  rows = locks.map { |lock| row(lock.record) }
  table(rows, header: %w[Scope Holder Held Alive Release], empty: "No locks for #{repo}.", slug: repo)
end