fix regexp, add dump argument to show parsed command

This commit is contained in:
sawka 2022-08-26 13:18:26 -07:00
parent dc8cba79da
commit 00b88f7f13

View File

@ -83,7 +83,7 @@ func getSourceStr(source string, w *syntax.Word) string {
return source[offset:end]
}
var ValidMetaCmdRe = regexp.MustCompile("^/([a-z][a-z0-9_-]*)(:[a-z][a-z0-9_-]*)?$")
var ValidMetaCmdRe = regexp.MustCompile("^/([a-z][a-z0-9_-]*)(?::([a-z][a-z0-9_-]*))?$")
type BareMetaCmdDecl struct {
CmdStr string
@ -206,5 +206,8 @@ func EvalMetaCommand(ctx context.Context, origPk *scpacket.FeCommandPacketType)
}
rtnPk.Args = append(rtnPk.Args, literalVal)
}
if resolveBool(rtnPk.Kwargs["dump"], false) {
DumpPacket(rtnPk)
}
return rtnPk, nil
}