• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3
4#
5# Copyright (c) 2020 Huawei Device Co., Ltd.
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10#     http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18import importlib
19import sys
20
21
22class Menuconfig():
23    @classmethod
24    def _promt(cls, questions, **kwargs):
25        prompt = importlib.import_module('hb_internal.cts.prompt')
26        common = importlib.import_module('hb_internal.cts.common')
27        return prompt.prompt(questions,
28                             style=common.get_style('answer'),
29                             **kwargs)
30
31    def list_promt(self, name, message, choices, **kwargs):
32        questions = self.get_questions('list', name, message, choices)
33
34        return self._promt(questions, **kwargs)
35
36    def checkbox_promt(self, name, message, choices, **kwargs):
37        questions = self.get_questions('checkbox', name, message, choices)
38
39        return self._promt(questions, **kwargs)
40
41    @classmethod
42    def get_questions(cls, promt_type, name, message, choices):
43        questions = [{
44            'type': promt_type,
45            'qmark': 'OHOS',
46            'name': name,
47            'message': message,
48            'choices': choices
49        }]
50
51        return questions
52
53
54if __name__ == "__main__":
55    pass
56