class GGIT
Public Class Methods
new(args, stdin)
click to toggle source
init
# File lib/g.rb, line 6 def initialize(args, stdin) parse_commands(args) end
Private Instance Methods
display_usage(msg=nil)
click to toggle source
# File lib/g.rb, line 32 def display_usage(msg=nil) puts "#{msg}\n\n" unless msg.nil? puts "Usage:\n\n" puts "g_ is-git? :Check if is a git repo.\n" end
parse_commands(args)
click to toggle source
# File lib/g.rb, line 12 def parse_commands(args) @commands = {} display_usage("#!Error: No commands") if args.size == 0 args.each do |arg| case arg when "is-git" `source ./thisfile.sh` break else display_usage("#!Error: Uknown command") end end end
set_current_branch()
click to toggle source
this piece of code is the most important
# File lib/g.rb, line 27 def set_current_branch @current ||= `git branch | grep "*" | awk '{print $2}'`.strip end