Пример #1
0
class php(Utils):
    def __init__(self, debug=False):
        self.localhost = './'
        self.logpath = '/home/nicolas/Bureau'

        self.PhpFile = File('Php').get_instence()
        self.debug = debug

    """
        @command php
        @syntax  python main.py php do create file -p name=<value> project=<value> content=<value>
        @method  create file
        @arg     str name
        @arg     str project
        @arg?    str content
    """

    def create_file(self, args):
        args = self.args(args)

        name = self.get_from_args('name', args)
        project = self.get_from_args('project', args)
        if self.get_from_args('content', args):
            content = self.get_from_args('content', args)
        else:
            content = '<?php\n' + \
                      ' class Hello {\n' + \
                      '     public static function World() {\n' + \
                      '         echo "Hello World";\n' + \
                      '     }\n' + \
                      ' }\n'

        self.PhpFile.create(self.localhost + project, name)
        self.PhpFile.cover(self.localhost + project, name, content)

    """
        @command php
        @syntax  python main.py php do rm file -p name=<value> project=<value>
        @method  rm file
        @arg     str name
        @arg     str project
    """

    def rm_file(self, args):
        args = self.args(args)

        name = self.get_from_args('name', args)
        project = self.get_from_args('project', args)

        self.PhpFile.remove(self.localhost + project, name)
Пример #2
0
class js(Utils):
    def __init__(self, debug):
        self.localhost = './'
        self.logpath = '/home/nicolas/Bureau'
        self.JsFile = File('Js').get_instence()
        self.debug = debug

    """
        @command js
        @syntax  python main.py js do create script -p name=<value> project=<value> content=<value>
        @method  create script
        @arg     str name
        @arg     str project
        @arg?    str content
    """

    def create_script(self, args):
        args = self.args(args)

        name = self.get_from_args('name', args)
        project = self.get_from_args('project', args)
        if self.get_from_args('content', args):
            content = self.get_from_args('content', args)
        else:
            content = 'let alert = () => {\n   alert( \'Hello World\' );\n};\n'

        self.JsFile.create(self.localhost + project, name)
        self.JsFile.cover(self.localhost + project, name, content)

    """
        @command js
        @syntax  python main.py js do rm script -p name=<value> project=<value>
        @method  rm script
        @arg     str name
        @arg     str project
    """

    def rm_script(self, args):
        args = self.args(args)

        name = self.get_from_args('name', args)
        project = self.get_from_args('project', args)

        self.JsFile.remove(self.localhost + project + '/js', name)