1# --------------------------------------------------------------------------------------------
2# Copyright (c) Microsoft Corporation. All rights reserved.
3# Licensed under the MIT License. See License.txt in the project root for license information.
4# --------------------------------------------------------------------------------------------
5
6import knack.output
7
8
9class AzOutputProducer(knack.output.OutputProducer):
10
11    def check_valid_format_type(self, format_type):
12        return format_type in self._FORMAT_DICT
13
14
15def get_output_format(cli_ctx):
16    return cli_ctx.invocation.data.get("output", None)
17
18
19def set_output_format(cli_ctx, desired_format):
20    if cli_ctx.output.check_valid_format_type(desired_format):
21        cli_ctx.invocation.data["output"] = desired_format
22