added notrunc flag

This commit is contained in:
Peter Morton 2023-10-16 21:49:53 -05:00
parent 77f520aa31
commit 98a65cdea8
2 changed files with 8 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import (
)
var filter string
var notrunc bool
// listCmd represents the list command
var listCmd = &cobra.Command{
@ -43,7 +44,11 @@ var listCmd = &cobra.Command{
t.SetOutputMirror(os.Stdout)
t.AppendHeader(table.Row{"Property Name", "Value", "Last Modified By", "Last Modified Date"})
for _, p := range collection.Member {
t.AppendRow([]interface{}{p.Name, truncateText(p.Value, 80), p.LastModifiedBy, p.LastModifiedDate})
text := p.Value
if !notrunc {
text = truncateText(text, 80)
}
t.AppendRow([]interface{}{p.Name, text, p.LastModifiedBy, p.LastModifiedDate})
}
t.Render()
@ -68,4 +73,5 @@ func init() {
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
listCmd.Flags().StringVarP(&filter, "filter", "f", "", "Filter properties using a query. For example --filter \"redaction\"")
listCmd.Flags().BoolVarP(&notrunc, "notrunc", "", false, "Prevent truncation of values")
}

View File

@ -35,7 +35,7 @@ func GetAccessToken(c *Config) (string, error) {
log.WithFields(log.Fields{"conf": fmt.Sprintf("%+v", conf)}).Debug()
token, err := conf.PasswordCredentialsToken(context.TODO(), c.Username, c.Password)
if err != nil {
log.Error("Error retrieving AccessToken. Chech configuration, username and password")
log.Error("Error retrieving AccessToken. Check configuration, username and password")
return "", err
}
log.WithFields(log.Fields{"token": fmt.Sprintf("%+v", token.AccessToken)}).Debug()