mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-02-22 02:41:23 +01:00
clear can either archive or purge lines
This commit is contained in:
parent
96b25900fc
commit
0f599207cf
@ -1665,15 +1665,28 @@ 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 err != nil {
|
||||
return nil, fmt.Errorf("clearing window: %v", err)
|
||||
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)
|
||||
}
|
||||
update.Info = &sstore.InfoMsgType{
|
||||
InfoMsg: fmt.Sprintf("window cleared"),
|
||||
TimeoutMs: 2000,
|
||||
}
|
||||
return update, nil
|
||||
}
|
||||
update.Info = &sstore.InfoMsgType{
|
||||
InfoMsg: fmt.Sprintf("window cleared"),
|
||||
TimeoutMs: 2000,
|
||||
}
|
||||
return update, nil
|
||||
|
||||
}
|
||||
|
||||
const DefaultMaxHistoryItems = 10000
|
||||
|
Loading…
Reference in New Issue
Block a user