mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
show environment
This commit is contained in:
parent
292c76808a
commit
429c41cfd0
@ -11,6 +11,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alessio/shellescape"
|
||||
"github.com/google/uuid"
|
||||
"github.com/scripthaus-dev/mshell/pkg/base"
|
||||
"github.com/scripthaus-dev/mshell/pkg/packet"
|
||||
@ -524,6 +525,20 @@ func SetEnvCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sstor
|
||||
return nil, fmt.Errorf("remote state is not available")
|
||||
}
|
||||
envMap := shexec.ParseEnv0(ids.RemoteState.Env0)
|
||||
if len(pk.Args) == 0 {
|
||||
var infoLines []string
|
||||
for varName, varVal := range envMap {
|
||||
line := fmt.Sprintf("%s=%s", varName, shellescape.Quote(varVal))
|
||||
infoLines = append(infoLines, line)
|
||||
}
|
||||
update := sstore.InfoUpdate{
|
||||
Info: &sstore.InfoMsgType{
|
||||
InfoTitle: fmt.Sprintf("[%s] environment", ids.RemoteName),
|
||||
InfoLines: infoLines,
|
||||
},
|
||||
}
|
||||
return update, nil
|
||||
}
|
||||
setVars := make(map[string]bool)
|
||||
for _, argStr := range pk.Args {
|
||||
eqIdx := strings.Index(argStr, "=")
|
||||
|
@ -84,8 +84,9 @@ type InfoMsgType struct {
|
||||
InfoTitle string `json:"infotitle"`
|
||||
InfoError string `json:"infoerror,omitempty"`
|
||||
InfoMsg string `json:"infomsg,omitempty"`
|
||||
InfoComps []string `json:"infocomps"`
|
||||
InfoCompsMore bool `json:"infocompssmore"`
|
||||
InfoComps []string `json:"infocomps,omitempty"`
|
||||
InfoCompsMore bool `json:"infocompssmore,omitempty"`
|
||||
InfoLines []string `json:"infolines,omitempty"`
|
||||
TimeoutMs int64 `json:"timeoutms,omitempty"`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user