Class: Gitcloudcli::CloudSpace

Inherits:
Thor
  • Object
show all
Defined in:
lib/gitcloudcli/command/space.rb

Overview

空间操作

Instance Method Summary collapse

Instance Method Details

#add(name, url, token) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/gitcloudcli/command/space.rb', line 16

def add(name, url, token)
    configs = Gitcloudcli.configHash
    if configs[name]
        puts "#{name} 已经存在"
        return
    end
    configs[name] = {
        "remote"=>url,
        "token"=>token
    }
    Gitcloudcli.configCover(configs)
end

#listObject



8
9
10
11
12
13
# File 'lib/gitcloudcli/command/space.rb', line 8

def list
    configs = Gitcloudcli.configHash
    configs.each do |key|
        puts "#{key[0]}  #{key[1]["remote"]}"
    end
end

#remove(name) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/gitcloudcli/command/space.rb', line 30

def remove(name)
    configs = Gitcloudcli.configHash
    if !configs[name]
        puts "#{name} 不存在"
        return
    end
    configs.delete(name)
    Gitcloudcli.configCover(configs)
end