Пример #1
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='HIEP-TRAN',
            group='demo',
            version='1.0',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='Execute SQLite Statement',
            icon_path=get_icon_path(__file__),
            description='Execute SQLite Statement',
    ) as mcxt:
        try:
            mcxt.add_argument('db_file',
                              display_name='Database file',
                              input_method='fileread;db',
                              help='SQLite database file')
            mcxt.add_argument('statements',
                              nargs="+",
                              display_name='SQLite statements file',
                              help='SQLite statements file')
            argspec = mcxt.parse_args(args)
            return exec(mcxt, argspec)
        except Exception as ex:
            print(ex)
Пример #2
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='jeon',
            group='demo',
            version='1.2',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='Google Spreadsheet',
            icon_path=get_icon_path(__file__),
            description='Google Spreadsheets Read Only',
    ) as mcxt:
        # ##################################### for app dependent parameters
        mcxt.add_argument('url',
                          display_name='URL',
                          help='google spreadsheets url')
        mcxt.add_argument('sheet_name',
                          display_name='Sheet Name',
                          help='if first sheet, please empty the compartment')
        mcxt.add_argument('sheet_range',
                          display_name='Range',
                          help='sheet range. ex) A2:E')
        mcxt.add_argument('json_file',
                          display_name='JSON File',
                          input_method='fileread',
                          help='credentials.json location')
        argspec = mcxt.parse_args(args)
        return g_sheet(mcxt, argspec)
Пример #3
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='ARGOS-LABS-DEMO',
            group='mygroup',
            version='1.0',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='My Calc',
            icon_path=get_icon_path(__file__),
            description='My Calculator',
    ) as mcxt:
        # ##################################### for app dependent parameters
        mcxt.add_argument('-n',
                          '--name',
                          nargs='+',
                          help='DB name to use',
                          display_name='DB Name')
        mcxt.add_argument('-f',
                          '--filepath',
                          display_name='DB file',
                          help='DB file path [[C:/Users/Desktop/Book.db]]')

        # ######################################## for app dependent options
        # mcxt.add_argument('-a', '--add', display_name='insert', nargs='*',
        #                   action='append', help='jkhkj [[jkhkjh]]')
        # mcxt.add_argument('-u', '--update', display_name='update', nargs='*',
        #                   action='append')
        # mcxt.add_argument('-d', '--delete', display_name='delete', nargs='*',
        #                   action='append')
        # mcxt.add_argument('-c', '--create', display_name='new DB', nargs='*',
        #                   action='append')
        mcxt.add_argument('-s',
                          '--sql',
                          display_name='SQL string',
                          nargs='*',
                          action='append',
                          help='SQL String to execute'
                          '[[INSERT INTO Book VALUES '
                          '(abc, 123, def, 1000)]]')
        mcxt.add_argument('-sf',
                          '--sqlfile',
                          display_name='SQL file',
                          help='SQL file to execute'
                          ' [[C:/Users/Desltop/test.txt]]')
        mcxt.add_argument('-c',
                          '--csv',
                          display_name='CSV input',
                          help='input data write [[1, \'abc\', 123, \'def\']]',
                          action='append')

        argspec = mcxt.parse_args(args)
        return do_eval(mcxt, argspec)
Пример #4
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
        owner='YOUR-LABS',
        group='demo',
        version='1.0',
        platform=['windows', 'darwin', 'linux'],
        output_type='text',
        display_name='My World',
        icon_path=get_icon_path(__file__),
        description='Hello World friends',
    ) as mcxt:
        # ##################################### for app dependent parameters
        mcxt.add_argument('name', nargs='+', help='name to say hello')
        argspec = mcxt.parse_args(args)
        return helloworld(mcxt, argspec)
Пример #5
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='jeon',
            group='demo',
            version='1.3',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='To PDF Plugin',
            icon_path=get_icon_path(__file__),
            description='PDF Converter',
    ) as mcxt:
        # ##################################### for app dependent parameters
        mcxt.add_argument('folder_route',
                          display_name='Folder Route',
                          input_method='folderread',
                          help='credentials.json location')
        mcxt.add_argument('pdf_name',
                          display_name='JPG to PDF name',
                          help='If this field is blank, the file name is output')
        mcxt.add_argument('--wordfile',
                          display_name='Word File',
                          action='store_true',
                          help='credentials.json location')
        mcxt.add_argument('--excelfile',
                          display_name='Excel File',
                          action='store_true',
                          help='credentials.json location')
        mcxt.add_argument('--jpgimage',
                          display_name='Jpg File',
                          action='store_true',
                          help='credentials.json location')
        argspec = mcxt.parse_args(args)
        return to_pdf(mcxt, argspec)
Пример #6
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='jeon',
            group='telegram',
            version='2.0',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='Telegram Plugin',
            icon_path=get_icon_path(__file__),
            description='Telegram Bot Plugin',
    ) as mcxt:
        # ##################################### for app dependent parameters
        mcxt.add_argument('bot_token',
                          display_name='Bot Token',
                          help='telegram bot token')
        mcxt.add_argument('chat_id',
                          display_name='Chat ID',
                          help='telegram Chat ID')
        mcxt.add_argument('message',
                          display_name='Message',
                          help='telegram bot send message')
        mcxt.add_argument('--screenshot',
                          display_name='Send Screenshot',
                          action='store_true',
                          help='telegram bot send screenshot')
        mcxt.add_argument('--control',
                          display_name='Scenario Control',
                          action='store_true',
                          help='yes or no button')
        argspec = mcxt.parse_args(args)
        return telegram_func(mcxt, argspec)
Пример #7
0
def _main(*args):
    """
    Build user argument and options and call plugin job function
    :param args: user arguments
    :return: return value from plugin job function
    """
    with ModuleContext(
            owner='Duk Kyu Lim',
            group='DEMO',
            version='1.0.1',
            platform=['windows', 'darwin', 'linux'],
            output_type='text',
            display_name='Python Run Script',
            icon_path=get_icon_path(__file__),
            description='Python Script Runner',
    ) as mcxt:
        mcxt.add_argument('--python_script',
                          input_method='multiline;python',
                          display_name='Python Script',
                          show_default=True,
                          input_group='radio=Code;defalut',
                          help='def main():')
        mcxt.add_argument('--python_file',
                          display_name='Python File',
                          show_default=True,
                          input_method='fileread',
                          input_group='radio=Code',
                          help='my_script.py')

        mcxt.add_argument('-a',
                          '--arguments',
                          display_name='Arguments',
                          show_default=True,
                          input_group='Arguments',
                          action='append',
                          help='abc or 123 - every values treats as string')
        mcxt.add_argument('-k',
                          '--key-arguments',
                          display_name='Keyword Arguments',
                          show_default=True,
                          input_group='Arguments',
                          action='append',
                          help='abc=123 or def="hello world" - '
                          'every values treats as string')

        mcxt.add_argument('-r',
                          '--requirements',
                          display_name='Requirements',
                          input_method='multiline;plain',
                          help='write module list you need to install '
                          'like requirements.txt')

        mcxt.add_argument('-e',
                          '--detail-error',
                          action='store_true',
                          display_name="Detail Error Message",
                          help='print detail error messages')

        # todo: using hidden option: --code option
        mcxt.add_argument('-c', '--code', action='store_true')

        argspec = mcxt.parse_args(args)
        return run_script(mcxt, argspec)