start unreg

This commit is contained in:
Dan Ballard 2015-02-24 09:47:07 -08:00
parent a42b1f2dcc
commit 2b2e41d474
2 changed files with 28 additions and 10 deletions

View File

@ -41,16 +41,7 @@ func regRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
// get either supplied nick or parse from dir // get either supplied nick or parse from dir
d := new(conf.DeploymentMsg) d := new(conf.DeploymentMsg)
d.Path = args[0] d.Path = warren.AbsPath(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
}
if len(args) >= 2 && strings.TrimSpace(args[1]) != "" { if len(args) >= 2 && strings.TrimSpace(args[1]) != "" {
d.Name = args[1] d.Name = args[1]
@ -74,5 +65,19 @@ func regRun(cmd *SockCommand, c net.Conn, path string, args ...string) {
// unreg path // unreg path
// unreg nick // unreg nick
func unregRun(cmd *SockCommand, c net.Conn, path string, args ...string) { 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.
}
} }

View File

@ -58,3 +58,16 @@ func ReadStringz(c net.Conn) (string, error) {
//return minux \000 //return minux \000
return data[0 : len(data)-1], nil 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
}