return clientid in WaveInfoData, print for wsh version -v (#1252)

This commit is contained in:
Mike Sawka 2024-11-08 14:19:56 -08:00 committed by GitHub
parent 3216bc2389
commit c34a5912e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 0 deletions

View File

@ -54,6 +54,7 @@ func runVersionCmd(cmd *cobra.Command, args []string) error {
if versionJSON {
info := map[string]interface{}{
"version": resp.Version,
"clientid": resp.ClientId,
"buildtime": resp.BuildTime,
"configdir": resp.ConfigDir,
"datadir": resp.DataDir,
@ -69,6 +70,7 @@ func runVersionCmd(cmd *cobra.Command, args []string) error {
// Default verbose text output
fmt.Printf("v%s (%s)\n", resp.Version, resp.BuildTime)
fmt.Printf("clientid: %s\n", resp.ClientId)
fmt.Printf("configdir: %s\n", resp.ConfigDir)
fmt.Printf("datadir: %s\n", resp.DataDir)
fmt.Printf("update-channel: %s\n", updateChannel)

View File

@ -869,6 +869,7 @@ declare global {
// wshrpc.WaveInfoData
type WaveInfoData = {
version: string;
clientid: string;
buildtime: string;
configdir: string;
datadir: string;

View File

@ -448,6 +448,7 @@ type VDomUrlRequestResponse struct {
type WaveInfoData struct {
Version string `json:"version"`
ClientId string `json:"clientid"`
BuildTime string `json:"buildtime"`
ConfigDir string `json:"configdir"`
DataDir string `json:"datadir"`

View File

@ -618,8 +618,13 @@ func (ws *WshServer) BlockInfoCommand(ctx context.Context, blockId string) (*wsh
}
func (ws *WshServer) WaveInfoCommand(ctx context.Context) (*wshrpc.WaveInfoData, error) {
client, err := wstore.DBGetSingleton[*waveobj.Client](ctx)
if err != nil {
return nil, fmt.Errorf("error getting client: %w", err)
}
return &wshrpc.WaveInfoData{
Version: wavebase.WaveVersion,
ClientId: client.OID,
BuildTime: wavebase.BuildTime,
ConfigDir: wavebase.GetWaveConfigDir(),
DataDir: wavebase.GetWaveDataDir(),