def outformat_is_json(): """ Only safe to call within a click context. """ ctx = click.get_current_context() state = ctx.ensure_object(CommandState) return state.outformat_is_json()