func Display()

in internal/display/display.go [46:67]


func Display(cliCtx *cli.Context, displayable *d.Displayable) error {
	displayStyle := cliCtx.String("display")
	if displayStyle == "" {
		commandFullName := cliCtx.Command.FullName()
		if commandFullName != "" {
			displayStyle = getDisplayStyle(commandFullName)
		} else {
			for _, c := range cliCtx.Lineage() {
				if s := getDisplayStyle(c.Args().First()); s != "" {
					displayStyle = s
					break
				}
			}
		}
	}
	if displayStyle == "" {
		displayStyle = "json"
	}
	ctx := cliCtx.Context
	ctx = context.WithValue(ctx, contextkey.Display{}, displayStyle)
	return display.Display(ctx, displayable)
}