Sha256: ae5707e80c9e141f98f1f91556bdb76f0985b038a928938c89201701f71d73b3

Contents?: true

Size: 1.51 KB

Versions: 4

Compression:

Stored size: 1.51 KB

Contents

require 'net/ssh'
require_relative "base"

module RoCommands
  class Git < Base

    desc 'exe', ''

    def exe(cmd, *args)
      _cmd = specific(cmd)

      _cmd = "git #{_cmd} #{args.join " "}"
      puts _cmd
      bash _cmd
    end

    private

    def specific(cmd)
      dict = {
          a: 'add',
          aa: 'add .',
          b: 'branch',
          co: 'checkout',
          c: 'commit -am',
          i: 'add -i',
          l: 'lo --oneline --all --color --raph --decorate',
          m: 'mere',
          po: 'push -u oriin develop',
          pv: 'push -u vps develop',
          st: 'status',
          t: 'tag'
      }

      dict[cmd.to_sym] if dict.has_key?(cmd.to_sym)
    end
    #desc 'run KEYWORDS', 'e.g. run r a means git remote add'
    #
    #def git(shortcuts.rb, *smth)
    #  shortcuts.rb.shift
    #
    #  match implicit(shortcuts.rb)
    #end
    #
    #def update_dict
    #  ls = bash_lines("git")
    #  cmds = ls.map do |l|
    #    r = l.match cmd?
    #    if r
    #
    #    end
    #  end
    #end
    #
    #private
    #
    #class Cmd
    #  attr_accessor :sup, :cmd, :sub, :whole
    #
    #  def initialize(sup, cmd, sub)
    #    @sup = sup
    #    @cmd = cmd
    #    @sub = get_child
    #    @whole = "#{sup.whole} #{cmd}"
    #  end
    #
    #  def to_s
    #    @cmd
    #  end
    #
    #  def help
    #    "#{@whole} -h"
    #  end
    #end
    #
    #def cmd?
    #  /\s{3}(\w+)/
    #end
    #
    #def dict
    #
    #end
    #
    #def match(implicit)
    #
    #end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ro_commands-0.0.4 lib/ro_commands/git.rb
ro_commands-0.0.3 lib/ro_commands/git.rb
ro_commands-0.0.2 lib/ro_commands/git.rb
ro_commands-0.0.1 lib/ro_commands/git.rb