# -*- coding: utf-8 -*- # @Author: JanKinCai # @Date: 2019-12-27 23:56:55 # @Last Modified by: JanKinCai # @Last Modified time: 2019-12-30 16:00:25 from interact import interacts config = { "name": { "type": "string", "default": "jankinca", "max_length": 10, "min_length": 1, "description": "Your name" }, "hex": { "type": "hex", # "default": "00", "description": "Buf" }, } if __name__ == "__main__": """ Your name [jankinca]: sssssssssssss Error: Invalided `sssssssssssss` Your name [jankinca]: jankincai """ print(interacts(config).name)
# @Date: 2019-12-27 23:56:55 # @Last Modified by: JanKinCai # @Last Modified time: 2019-12-30 16:16:28 from interact import interacts config = { "mac": { "type": "mac", "default": "aa:bb:cc:dd:ee:ff", "description": "MAC" }, "ipv4": { "type": "ipv4", "default": "192.168.166.2", "description": "IPv4 address", }, "ipv4_cidr": { "type": "cidr", "default": "192.168.166.2/24", "description": "IPv4 address", } } if __name__ == "__main__": """ > MAC [aa:bb:cc:dd:ee:ff]: aa:bb:cc:dd:ee Error: Invalided `aa:bb:cc:dd:ee` """ print(interacts(config).mac)
"choice": ["github", "gitee", "gitlab"], "description": "Code hosting", "when": "use_code_hosting == true" }, "code_hosting_username": { "type": "string", "default": "jankincai", "description": "Your code hosting username", "when": "use_code_hosting == true" } } if __name__ == "__main__": """ Use code hosting platform [y]: y Select code hosting: 1 - github 2 - gitee 3 - gitlab Choose from [1]: Your code hosting username [jankincai]: jankincai {'use_code_hosting': True, 'code_hosting': 'github', 'code_hosting_username': '******'} """ """ Use code hosting platform [y]: n {'use_code_hosting': False, 'code_hosting': None, 'code_hosting_username': None} """ print(interacts(config).get_interact_data())
# -*- coding: utf-8 -*- # @Author: JanKinCai # @Date: 2019-12-26 23:15:03 # @Last Modified by: JanKinCai # @Last Modified time: 2019-12-28 00:02:51 from interact import interacts config = { "ipv4": { "type": "string", "regex": r"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$", "default": "192.168.166.12", "description": "IPv4 address" } } if __name__ == "__main__": """ IPv4 address [192.168.166.12]: 22 Error: Invalided `22` IPv4 address [192.168.166.12]: 192.168.166.2 """ print(interacts(config).ipv4)
# -*- coding: utf-8 -*- # @Author: JanKinCai # @Date: 2019-12-26 23:15:03 # @Last Modified by: JanKinCai # @Last Modified time: 2019-12-30 16:04:17 from interact import interacts config = { "port": { "type": "int", "default": 22, "max_value": 30, "min_value": 20, "description": "Port" } } if __name__ == "__main__": """ Port [22]: 32 Error: Invalided `32`, max_value=30, min_value=20 Port [22]: 10 Error: Invalided `10`, max_value=30, min_value=20 Port [22]: 25 """ print(interacts(config).port)