Skip to content

Commit

Permalink
remove getName in hc_get
Browse files Browse the repository at this point in the history
Signed-off-by: noobcoder <zhaoyi_114@outlook.com>
  • Loading branch information
tiansuo114 authored and caoxianfei1 committed Dec 14, 2023
1 parent ed6a13d commit 1376628
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 1 addition & 11 deletions internal/configure/hosts/hc_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,7 @@ func (hc *HostConfig) getBool(i *comm.Item) bool {
return v.(bool)
}

func (hc *HostConfig) getName() string {
res := hc.GetHost()
if res != "" {
return res
}

return hc.getString(CONFIG_NAME)
}

func (hc *HostConfig) GetHost() string { return hc.getString(CONFIG_HOST) }
func (hc *HostConfig) GetName() string { return hc.getName() }
func (hc *HostConfig) GetName() string { return hc.getString(CONFIG_NAME) }
func (hc *HostConfig) GetHostname() string { return hc.getString(CONFIG_HOSTNAME) }
func (hc *HostConfig) GetSSHHostname() string { return hc.getString(CONFIG_SSH_HOSTNAME) }
func (hc *HostConfig) GetSSHPort() int { return hc.getInt(CONFIG_SSH_PORT) }
Expand Down
5 changes: 4 additions & 1 deletion internal/configure/hosts/hc_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ var (
"name",
comm.REQUIRE_STRING,
false,
nil,
func(hc *HostConfig) interface{} {
return hc.getString(CONFIG_HOST)
},
)

CONFIG_HOSTNAME = itemset.Insert(
"hostname",
comm.REQUIRE_STRING,
Expand Down

0 comments on commit 1376628

Please sign in to comment.