Class: MGit::CloneCommand
Instance Method Summary
collapse
Methods inherited from Command
#check_arity, create, execute, instance_each, list, load_commands, register_alias, register_command, require_commands_from_directory
Methods included from Output
#perror, #pinfo, #psystem, #ptable, #pwarn
Instance Method Details
#arity ⇒ Object
15
16
17
|
# File 'lib/mgit/commands/clone.rb', line 15
def arity
[1, nil]
end
|
#description ⇒ Object
23
24
25
|
# File 'lib/mgit/commands/clone.rb', line 23
def description
'clone repository and add to mgit'
end
|
#execute(args) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/mgit/commands/clone.rb', line 3
def execute(args)
log = System.git("clone #{args.join(' ')}", raise: true)
m = [log.stdout, log.stderr].find do |l|
/Cloning into '(.*)'/.match(l.split("\n").first)
end
fail 'Failed to determine repository directory.' unless m
Command.execute('add', [m[1]])
end
|
#usage ⇒ Object
19
20
21
|
# File 'lib/mgit/commands/clone.rb', line 19
def usage
'clone [options] <url> [<directory>]'
end
|