Skip to content

Commit

Permalink
Merge pull request #48 from overmindtech/manual-change
Browse files Browse the repository at this point in the history
Implement manual-change subcommand
  • Loading branch information
DavidS-ovm authored Aug 22, 2023
2 parents 40f8bc8 + 38d9826 commit 5679eeb
Show file tree
Hide file tree
Showing 8 changed files with 428 additions and 45 deletions.
16 changes: 3 additions & 13 deletions cmd/getbookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,16 @@ func GetBookmark(signals chan os.Signal, ready chan bool) int {
}
log.WithContext(ctx).WithFields(log.Fields{
"bookmark-uuid": uuid.UUID(response.Msg.Bookmark.Metadata.UUID),
"bookmark-created": response.Msg.Bookmark.Metadata.Created,
"bookmark-created": response.Msg.Bookmark.Metadata.Created.AsTime(),
"bookmark-name": response.Msg.Bookmark.Properties.Name,
"bookmark-description": response.Msg.Bookmark.Properties.Description,
}).Info("found bookmark")
for _, q := range response.Msg.Bookmark.Properties.Queries {
log.WithContext(ctx).WithFields(log.Fields{
"bookmark-query": q,
}).Info("found bookmark query")
}
for _, i := range response.Msg.Bookmark.Properties.ExcludedItems {
log.WithContext(ctx).WithFields(log.Fields{
"bookmark-excluded-item": i,
}).Info("found bookmark excluded item")
}

b, err := json.MarshalIndent(response.Msg.Bookmark.Properties, "", " ")
b, err := json.MarshalIndent(response.Msg.Bookmark.ToMap(), "", " ")
if err != nil {
log.Infof("Error rendering bookmark: %v", err)
} else {
log.Info(string(b))
fmt.Println(string(b))
}

return 0
Expand Down
6 changes: 3 additions & 3 deletions cmd/getchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ func GetChange(signals chan os.Signal, ready chan bool) int {

switch viper.GetString("format") {
case "json":
b, err := json.MarshalIndent(response.Msg.Change, "", " ")
b, err := json.MarshalIndent(response.Msg.Change.ToMap(), "", " ")
if err != nil {
log.Errorf("Error rendering bookmark: %v", err)
return 1
} else {
fmt.Println(string(b))
}

fmt.Println(string(b))
case "markdown":
changeUrl := fmt.Sprintf("%v/changes/%v", viper.GetString("frontend"), changeUuid.String())
if response.Msg.Change.Metadata.NumAffectedApps != 0 || response.Msg.Change.Metadata.NumAffectedItems != 0 {
Expand Down
13 changes: 11 additions & 2 deletions cmd/getsnapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"context"
"encoding/json"
"fmt"
"os"
"os/signal"
Expand Down Expand Up @@ -84,8 +85,8 @@ func GetSnapshot(signals chan os.Signal, ready chan bool) int {
return 1
}
log.WithContext(ctx).WithFields(log.Fields{
"snapshot-uuid": response.Msg.Snapshot.Metadata.UUID,
"snapshot-created": response.Msg.Snapshot.Metadata.Created,
"snapshot-uuid": uuid.UUID(response.Msg.Snapshot.Metadata.UUID),
"snapshot-created": response.Msg.Snapshot.Metadata.Created.AsTime(),
"snapshot-name": response.Msg.Snapshot.Properties.Name,
"snapshot-description": response.Msg.Snapshot.Properties.Description,
}).Info("found snapshot")
Expand All @@ -104,6 +105,14 @@ func GetSnapshot(signals chan os.Signal, ready chan bool) int {
"snapshot-item": i,
}).Info("found snapshot item")
}

b, err := json.MarshalIndent(response.Msg.Snapshot.ToMap(), "", " ")
if err != nil {
log.Infof("Error rendering snapshot: %v", err)
} else {
fmt.Println(string(b))
}

return 0
}

Expand Down
Loading

0 comments on commit 5679eeb

Please sign in to comment.