コード例 #1
0
ファイル: __init__.py プロジェクト: Verbalist/aioframe
    def __init__(self):
        self.path = os.getcwd()
        self.argv = sys.argv[1:]

        if len(self.argv) < 3:
            print(console_help)
            return

        self.command, self.object, self.name = self.argv

        if self.command not in COMMAND:
            print(bad_command.format(self.command))
            return

        if self.object not in OBJECT:
            print(bad_object.format(self.object))
            return

        if self.name in os.listdir(self.path) and self.command == 'create':
            print(bad_name.format(self.name))
            return

        try:
            obj = getattr(aioframe.core, self.object)(self.name, self.path)
            getattr(obj, self.command)()
        except Exception as e:
            print(e)
コード例 #2
0
ファイル: test_command.py プロジェクト: Verbalist/aioframe
 def test_process_command_help_bad_command(self):
     _help = subprocess.check_output(['aioframe a a a'], shell=True)
     assert _help == bad_command.format('a').encode() + b'\n'