mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-23 02:51:26 +01:00
clear can either archive or purge lines
This commit is contained in:
parent
96b25900fc
commit
0f599207cf
@ -1665,7 +1665,18 @@ func ClearCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
update, err := sstore.ClearWindow(ctx, ids.SessionId, ids.WindowId)
|
||||
if resolveBool(pk.Kwargs["purge"], false) {
|
||||
update, err := sstore.PurgeWindowLines(ctx, ids.SessionId, ids.WindowId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("clearing window: %v", err)
|
||||
}
|
||||
update.Info = &sstore.InfoMsgType{
|
||||
InfoMsg: fmt.Sprintf("window cleared (all lines purged)"),
|
||||
TimeoutMs: 2000,
|
||||
}
|
||||
return update, nil
|
||||
} else {
|
||||
update, err := sstore.ArchiveWindowLines(ctx, ids.SessionId, ids.WindowId)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("clearing window: %v", err)
|
||||
}
|
||||
@ -1676,6 +1687,8 @@ func ClearCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore
|
||||
return update, nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const DefaultMaxHistoryItems = 10000
|
||||
|
||||
func HistoryCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstore.UpdatePacket, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user