start unreg
This commit is contained in:
parent
a42b1f2dcc
commit
2b2e41d474
|
@ -41,16 +41,7 @@ func regRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
|||
|
||||
// get either supplied nick or parse from dir
|
||||
d := new(conf.DeploymentMsg)
|
||||
d.Path = args[0]
|
||||
|
||||
// ./local_path
|
||||
if d.Path[0] == '.' {
|
||||
d.Path = path + d.Path[2:]
|
||||
} else
|
||||
// local_path
|
||||
if d.Path[0] != '/' {
|
||||
d.Path = path + d.Path
|
||||
}
|
||||
d.Path = warren.AbsPath(path, args[0])
|
||||
|
||||
if len(args) >= 2 && strings.TrimSpace(args[1]) != "" {
|
||||
d.Name = args[1]
|
||||
|
@ -74,5 +65,19 @@ func regRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
|||
// unreg path
|
||||
// unreg nick
|
||||
func unregRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
|
||||
|
||||
if (len(args) > 0 && args[0] == "help") || len(args) < 1 {
|
||||
warren.WriteStringz(c, cmd.Usage)
|
||||
return
|
||||
}
|
||||
|
||||
err := conf.RmDeployment(args[0])
|
||||
|
||||
// Assume nick, check if registered
|
||||
deps := conf.GetConf().Deployments
|
||||
arg := args[0]
|
||||
if _,ok := deps[arg]; !ok {
|
||||
// not a registered nick, try as path
|
||||
absPath := absPath(path, arg)
|
||||
if _,ok := conf.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,3 +58,16 @@ func ReadStringz(c net.Conn) (string, error) {
|
|||
//return minux \000
|
||||
return data[0 : len(data)-1], nil
|
||||
}
|
||||
|
||||
func AbsPath(wd, path string) string {
|
||||
// ./local_path
|
||||
if path[0] == '.' {
|
||||
return wd + path[2:]
|
||||
} else
|
||||
// local_path
|
||||
if path[0] != '/' {
|
||||
return wd + path
|
||||
}
|
||||
return path
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue