Class: Synco::Command::Top

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/synco/command.rb

Instance Method Summary collapse

Instance Method Details

#callObject



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/synco/command.rb', line 59

def call
  if @options[:version]
    puts "synco v#{Synco::VERSION}"
  elsif @options[:help] or @command.nil?
    print_usage(program_name)
  else
    chdir do
      @command.call
    end
  end
end

#chdir(&block) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/synco/command.rb', line 43

def chdir(&block)
  if root = @options[:root]
    Dir.chdir(root, &block)
  else
    yield
  end
end