add non-parsing commands to history

This commit is contained in:
sawka 2022-08-31 00:01:42 -07:00
parent 76854b6079
commit 8b11af6822

View File

@ -201,19 +201,19 @@ func EvalCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.
if len(pk.Args) == 0 { if len(pk.Args) == 0 {
return nil, fmt.Errorf("usage: /eval [command], no command passed to eval") return nil, fmt.Errorf("usage: /eval [command], no command passed to eval")
} }
newPk, err := EvalMetaCommand(ctx, pk) var update sstore.UpdatePacket
if err != nil { newPk, rtnErr := EvalMetaCommand(ctx, pk)
return nil, err if rtnErr == nil {
update, rtnErr = HandleCommand(ctx, newPk)
} }
update, err := HandleCommand(ctx, newPk)
if !resolveBool(pk.Kwargs["nohist"], false) { if !resolveBool(pk.Kwargs["nohist"], false) {
err := addToHistory(ctx, pk, update, (newPk.MetaCmd != "run"), (err != nil)) err := addToHistory(ctx, pk, update, (newPk.MetaCmd != "run"), (rtnErr != nil))
if err != nil { if err != nil {
fmt.Printf("[error] adding to history: %v\n", err) fmt.Printf("[error] adding to history: %v\n", err)
// continue... // continue...
} }
} }
return update, err return update, rtnErr
} }
func ScreenCloseCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) { func ScreenCloseCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {