Sha256: 12bb2339a521a6aa74cfbcd5c4887bc5221619c0ff487b507dfbe09141ea92b8
Contents?: true
Size: 722 Bytes
Versions: 8
Compression:
Stored size: 722 Bytes
Contents
require 'git-utils/command' class Switch < Command def parser OptionParser.new do |opts| opts.banner = "Usage: git switch <pattern>" opts.on_tail("-h", "--help", "this usage guide") do puts opts.to_s; exit 0 end end end # Returns the branch to switch to. def other_branch @other_branch ||= `git branch | grep #{pattern}`.strip end # Returns a command appropriate for executing at the command line def cmd c = ["git checkout #{other_branch}"] c << argument_string(unknown_options) unless unknown_options.empty? c.join("\n") end private # Returns the pattern of the branch to switch to. def pattern self.known_options.first end end
Version data entries
8 entries across 8 versions & 1 rubygems