From 2e70ffd209580e07d9a6d39906eaf45a88971db1 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Wed, 6 Mar 2024 12:10:18 -0500 Subject: [PATCH 1/5] checkout listing changes --- src/cmd/property.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/cmd/property.go b/src/cmd/property.go index f64fb40c..c5853577 100644 --- a/src/cmd/property.go +++ b/src/cmd/property.go @@ -3,6 +3,7 @@ package cmd import ( "encoding/json" "fmt" + "strings" "github.com/opslevel/opslevel-go/v2024" @@ -70,13 +71,15 @@ var listPropertyCmd = &cobra.Command{ if isJsonOutput() { common.JsonPrint(json.MarshalIndent(properties.Nodes, "", " ")) } else { - w := common.NewTabWriter("DEFINITION_ID", "VALUE", "LEN_VALIDATION_ERRORS") - for _, prop := range properties.Nodes { + w := common.NewTabWriter("DEF_ID", "ALIASES", "VALUE", "VALIDATION_ERRS", "LOCKED") + for _, p := range properties.Nodes { var valueOutput string - if prop.Value != nil { - valueOutput = string(*prop.Value) + if p.Value != nil { + valueOutput = string(*p.Value) } - fmt.Fprintf(w, "%s\t%s\t%d\n", string(prop.Definition.Id), valueOutput, len(prop.ValidationErrors)) + format := "%s\t%s\t%s\t%d\t%t\n" + aliases := strings.Join(p.Definition.Aliases, ",") + fmt.Fprintf(w, format, string(p.Definition.Id), aliases, valueOutput, len(p.ValidationErrors), p.Locked) } w.Flush() } @@ -240,9 +243,10 @@ var listPropertyDefinitionsCmd = &cobra.Command{ if isJsonOutput() { common.JsonPrint(json.MarshalIndent(list, "", " ")) } else { - w := common.NewTabWriter("ALIASES", "ID", "NAME", "SCHEMA") - for _, item := range list { - fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Aliases, item.Id, item.Name, item.Schema.ToJSON()) + w := common.NewTabWriter("ALIASES", "ID", "NAME", "SCHEMA", "DISPLAY_STATUS", "ALLOWED_IN_CONFIG_FILES") + for _, d := range list { + format := "%s\t%s\t%s\t%s\t%s\t%t\n" + fmt.Fprintf(w, format, d.Aliases, d.Id, d.Name, d.Schema.ToJSON(), d.PropertyDisplayStatus, d.AllowedInConfigFiles) } w.Flush() } From fad004cc9fe764dd9ae2d86095d39f1e7d461887 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Wed, 6 Mar 2024 12:12:21 -0500 Subject: [PATCH 2/5] task fix, changie --- .../unreleased/Feature-20240306-121130.yaml | 3 ++ .../unreleased/Feature-20240306-121209.yaml | 3 ++ src/go.mod | 10 +++--- src/go.sum | 34 ++++++++----------- 4 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 .changes/unreleased/Feature-20240306-121130.yaml create mode 100644 .changes/unreleased/Feature-20240306-121209.yaml diff --git a/.changes/unreleased/Feature-20240306-121130.yaml b/.changes/unreleased/Feature-20240306-121130.yaml new file mode 100644 index 00000000..2269490e --- /dev/null +++ b/.changes/unreleased/Feature-20240306-121130.yaml @@ -0,0 +1,3 @@ +kind: Feature +body: Show DISPLAY_STATUS, ALLOWED_IN_CONFIG_FILES when listing property definitions +time: 2024-03-06T12:11:30.251694-05:00 diff --git a/.changes/unreleased/Feature-20240306-121209.yaml b/.changes/unreleased/Feature-20240306-121209.yaml new file mode 100644 index 00000000..a564c822 --- /dev/null +++ b/.changes/unreleased/Feature-20240306-121209.yaml @@ -0,0 +1,3 @@ +kind: Feature +body: Show ALIASES, LOCKED when listing assigned properties on a service +time: 2024-03-06T12:12:09.686275-05:00 diff --git a/src/go.mod b/src/go.mod index 596dd0a2..9a48b52a 100644 --- a/src/go.mod +++ b/src/go.mod @@ -43,7 +43,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect - github.com/go-playground/validator/v10 v10.18.0 // indirect + github.com/go-playground/validator/v10 v10.19.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/uuid v1.6.0 // indirect @@ -52,7 +52,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hasura/go-graphql-client v0.11.0 // indirect + github.com/hasura/go-graphql-client v0.12.1 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/itchyny/timefmt-go v0.1.5 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect @@ -90,10 +90,10 @@ require ( go.opentelemetry.io/otel/sdk v1.21.0 // indirect go.opentelemetry.io/otel/trace v1.21.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/mod v0.14.0 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.17.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.15.0 // indirect google.golang.org/protobuf v1.32.0 // indirect diff --git a/src/go.sum b/src/go.sum index 32f64518..fd61e1bf 100644 --- a/src/go.sum +++ b/src/go.sum @@ -103,8 +103,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= -github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= +github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4= +github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-resty/resty/v2 v2.11.0 h1:i7jMfNOJYMp69lq7qozJP+bjgzfAzeOhuGlyDrqxT/8= github.com/go-resty/resty/v2 v2.11.0/go.mod h1:iiP/OpA0CkcL3IGt1O0+/SIItFUbkkyw5BGXiVdTu+A= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= @@ -129,16 +129,10 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= github.com/gosimple/slug v1.14.0 h1:RtTL/71mJNDfpUbCOmnf/XFkzKRtD6wL6Uy+3akm4Es= github.com/gosimple/slug v1.14.0/go.mod h1:UiRaFH+GEilHstLUmcBgWcI42viBN7mAb818JrYOeFQ= github.com/gosimple/unidecode v1.0.1 h1:hZzFTMMqSswvf0LBJZCZgThIZrpDHFXux9KeGmn6T/o= github.com/gosimple/unidecode v1.0.1/go.mod h1:CP0Cr1Y1kogOtx0bJblKzsVWrqYaqfNOnHzpgWw4Awc= -github.com/graph-gophers/graphql-go v1.5.0 h1:fDqblo50TEpD0LY7RXk/LFVYEVqo3+tXMNMPSVXA1yc= -github.com/graph-gophers/graphql-go v1.5.0/go.mod h1:YtmJZDLbF1YYNrlNAuiO5zAStUWc3XZT07iGsVqe1Os= -github.com/graph-gophers/graphql-transport-ws v0.0.2 h1:DbmSkbIGzj8SvHei6n8Mh9eLQin8PtA8xY9eCzjRpvo= -github.com/graph-gophers/graphql-transport-ws v0.0.2/go.mod h1:5BVKvFzOd2BalVIBFfnfmHjpJi/MZ5rOj8G55mXvZ8g= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rHAxPBD8KFhJpmcqms= github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -150,8 +144,8 @@ github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/hasura/go-graphql-client v0.11.0 h1:EFEkpMZlkq5gLZj9oiI6TnHCOHV1oErxOroMc5qUHQI= -github.com/hasura/go-graphql-client v0.11.0/go.mod h1:eNNnmHAp6NgwKZ4xRbZEfywxr07qk34Y0QhbPsYIfhw= +github.com/hasura/go-graphql-client v0.12.1 h1:tL+BCoyubkYYyaQ+tJz+oPe/pSxYwOJHwe5SSqqi6WI= +github.com/hasura/go-graphql-client v0.12.1/go.mod h1:F4N4kR6vY8amio3gEu3tjSZr8GPOXJr3zj72DKixfLE= github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= @@ -166,8 +160,8 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= -github.com/klauspost/compress v1.17.4 h1:Ej5ixsIri7BrIjBkRZLTo6ghwrEtHFk7ijlczPW4fZ4= -github.com/klauspost/compress v1.17.4/go.mod h1:/dCuZOvVtNoHsyb+cuJD3itjs3NbnF6KH9zAO4BDxPM= +github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= +github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -308,8 +302,8 @@ golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa h1:FRnLl4eNAQl8hwxVVC17teOw8kdjVDVAiFMtgUdTSRQ= golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa/go.mod h1:zk2irFbV9DP96SEBUUAy67IdHUaZuSnrz1n472HUCLE= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -325,8 +319,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -351,8 +345,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -360,8 +354,8 @@ golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= From 9b761536cdfbaaa2e9e70da0f13f4fb1a57104b8 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Wed, 6 Mar 2024 14:43:03 -0500 Subject: [PATCH 3/5] forgot to push --- .../unreleased/Feature-20240306-144105.yaml | 3 ++ src/cmd/property.go | 29 +++++++++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 .changes/unreleased/Feature-20240306-144105.yaml diff --git a/.changes/unreleased/Feature-20240306-144105.yaml b/.changes/unreleased/Feature-20240306-144105.yaml new file mode 100644 index 00000000..988d9d8d --- /dev/null +++ b/.changes/unreleased/Feature-20240306-144105.yaml @@ -0,0 +1,3 @@ +kind: Feature +body: -o csv support for property definitions and assignments +time: 2024-03-06T14:41:05.516887-05:00 diff --git a/src/cmd/property.go b/src/cmd/property.go index c5853577..c196c4b8 100644 --- a/src/cmd/property.go +++ b/src/cmd/property.go @@ -1,8 +1,10 @@ package cmd import ( + "encoding/csv" "encoding/json" "fmt" + "os" "strings" "github.com/opslevel/opslevel-go/v2024" @@ -70,16 +72,23 @@ var listPropertyCmd = &cobra.Command{ if isJsonOutput() { common.JsonPrint(json.MarshalIndent(properties.Nodes, "", " ")) + } else if isCsvOutput() { + w := csv.NewWriter(os.Stdout) + w.Write([]string{"ID", "LOCKED", "ALIASES"}) + for _, p := range properties.Nodes { + aliases := strings.Join(p.Definition.Aliases, "/") + w.Write([]string{string(p.Definition.Id), fmt.Sprintf("%t", p.Locked), aliases}) + } + w.Flush() } else { - w := common.NewTabWriter("DEF_ID", "ALIASES", "VALUE", "VALIDATION_ERRS", "LOCKED") + w := common.NewTabWriter("ID", "LOCKED", "VALUE", "ALIASES") for _, p := range properties.Nodes { var valueOutput string if p.Value != nil { valueOutput = string(*p.Value) } - format := "%s\t%s\t%s\t%d\t%t\n" aliases := strings.Join(p.Definition.Aliases, ",") - fmt.Fprintf(w, format, string(p.Definition.Id), aliases, valueOutput, len(p.ValidationErrors), p.Locked) + fmt.Fprintf(w, "%s\t%t\t%s\t%s\n", string(p.Definition.Id), p.Locked, valueOutput, aliases) } w.Flush() } @@ -242,11 +251,19 @@ var listPropertyDefinitionsCmd = &cobra.Command{ cobra.CheckErr(err) if isJsonOutput() { common.JsonPrint(json.MarshalIndent(list, "", " ")) + } else if isCsvOutput() { + w := csv.NewWriter(os.Stdout) + w.Write([]string{"ALIASES", "ID", "NAME", "DISPLAY_STATUS", "ALLOWED_IN_CONFIG_FILES"}) + for _, d := range list { + aliases := strings.Join(d.Aliases, "/") + w.Write([]string{aliases, string(d.Id), d.Name, string(d.PropertyDisplayStatus), fmt.Sprintf("%t", d.AllowedInConfigFiles)}) + } + w.Flush() } else { - w := common.NewTabWriter("ALIASES", "ID", "NAME", "SCHEMA", "DISPLAY_STATUS", "ALLOWED_IN_CONFIG_FILES") + w := common.NewTabWriter("ALIASES", "ID", "NAME", "DISPLAY_STATUS", "ALLOWED_IN_CONFIG_FILES") for _, d := range list { - format := "%s\t%s\t%s\t%s\t%s\t%t\n" - fmt.Fprintf(w, format, d.Aliases, d.Id, d.Name, d.Schema.ToJSON(), d.PropertyDisplayStatus, d.AllowedInConfigFiles) + aliases := strings.Join(d.Aliases, "/") + fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%t\n", aliases, d.Id, d.Name, d.PropertyDisplayStatus, d.AllowedInConfigFiles) } w.Flush() } From fc4b3c57f8137f4c85d080d2007cb6c1d5ea6087 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Wed, 6 Mar 2024 14:44:31 -0500 Subject: [PATCH 4/5] removed logs --- .changes/unreleased/Removed-20240306-144336.yaml | 3 +++ .changes/unreleased/Removed-20240306-144423.yaml | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 .changes/unreleased/Removed-20240306-144336.yaml create mode 100644 .changes/unreleased/Removed-20240306-144423.yaml diff --git a/.changes/unreleased/Removed-20240306-144336.yaml b/.changes/unreleased/Removed-20240306-144336.yaml new file mode 100644 index 00000000..5c135ebb --- /dev/null +++ b/.changes/unreleased/Removed-20240306-144336.yaml @@ -0,0 +1,3 @@ +kind: Removed +body: Removed LEN_VALIDATION_ERRORS from property definitions list +time: 2024-03-06T14:43:36.578507-05:00 diff --git a/.changes/unreleased/Removed-20240306-144423.yaml b/.changes/unreleased/Removed-20240306-144423.yaml new file mode 100644 index 00000000..8764e956 --- /dev/null +++ b/.changes/unreleased/Removed-20240306-144423.yaml @@ -0,0 +1,3 @@ +kind: Removed +body: Removed SCHEMA from property definitions list +time: 2024-03-06T14:44:23.829891-05:00 From 9c35740451af1cf019f7e8e99b623ea4731c8351 Mon Sep 17 00:00:00 2001 From: Taimoor Ahmad Date: Wed, 6 Mar 2024 14:50:02 -0500 Subject: [PATCH 5/5] reword changelog --- .changes/unreleased/Removed-20240306-144336.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/unreleased/Removed-20240306-144336.yaml b/.changes/unreleased/Removed-20240306-144336.yaml index 5c135ebb..c108e016 100644 --- a/.changes/unreleased/Removed-20240306-144336.yaml +++ b/.changes/unreleased/Removed-20240306-144336.yaml @@ -1,3 +1,3 @@ kind: Removed -body: Removed LEN_VALIDATION_ERRORS from property definitions list +body: Removed LEN_VALIDATION_ERRORS from service properties list time: 2024-03-06T14:43:36.578507-05:00