Module: Command

Defined in:
lib/command.rb,
lib/command/rm.rb,
lib/command/add.rb,
lib/command/log.rb,
lib/command/base.rb,
lib/command/diff.rb,
lib/command/init.rb,
lib/command/push.rb,
lib/command/fetch.rb,
lib/command/merge.rb,
lib/command/reset.rb,
lib/command/branch.rb,
lib/command/commit.rb,
lib/command/config.rb,
lib/command/remote.rb,
lib/command/revert.rb,
lib/command/status.rb,
lib/command/checkout.rb,
lib/command/rev_list.rb,
lib/command/cherry_pick.rb,
lib/command/upload_pack.rb,
lib/command/receive_pack.rb,
lib/command/shared/print_diff.rb,
lib/command/shared/sequencing.rb,
lib/command/shared/fast_forward.rb,
lib/command/shared/remote_agent.rb,
lib/command/shared/send_objects.rb,
lib/command/shared/write_commit.rb,
lib/command/shared/remote_client.rb,
lib/command/shared/receive_objects.rb

Defined Under Namespace

Modules: FastForward, PrintDiff, ReceiveObjects, RemoteAgent, RemoteClient, SendObjects, Sequencing, WriteCommit Classes: Add, Base, Branch, Checkout, CherryPick, Commit, Config, Diff, Fetch, Init, Log, Merge, Push, ReceivePack, Remote, Reset, RevList, Revert, Rm, Status, UploadPack

Constant Summary collapse

Unknown =
Class.new(StandardError)
COMMANDS =
{
  "init"         => Init,
  "config"       => Config,
  "add"          => Add,
  "rm"           => Rm,
  "commit"       => Commit,
  "status"       => Status,
  "diff"         => Diff,
  "branch"       => Branch,
  "checkout"     => Checkout,
  "reset"        => Reset,
  "rev-list"     => RevList,
  "log"          => Log,
  "merge"        => Merge,
  "cherry-pick"  => CherryPick,
  "revert"       => Revert,
  "remote"       => Remote,
  "fetch"        => Fetch,
  "push"         => Push,
  "upload-pack"  => UploadPack,
  "receive-pack" => ReceivePack
}

Class Method Summary collapse

Class Method Details

.execute(dir, env, argv, stdin, stdout, stderr) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/command.rb', line 48

def self.execute(dir, env, argv, stdin, stdout, stderr)
  name = argv.first
  args = argv.drop(1)

  unless COMMANDS.has_key?(name)
    raise Unknown, "'#{ name }' is not a jit command."
  end

  command_class = COMMANDS[name]
  command = command_class.new(dir, env, args, stdin, stdout, stderr)

  command.execute
  command
end