PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/bin/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/thread-self/root/proc/self/root/proc/self/root/proc/thread-self/root/bin/cl-phpextdesc

#!/opt/cloudlinux/venv/bin/python3 -bb
# -*- coding: utf-8 -*-

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import sys
import os
import getopt
import simplejson

class ParseText(object):
    def __init__(self, source):
        if not os.path.isfile(source):
            print("ERROR: invalid source (%s)" % (source,))
            sys.exit(2)
        self.dataset = []
        source_handle = open(source,'r')
        for line in source_handle:
            if '=' not in line:
                continue
            (extension_name, extension_description) = line.strip().split('=')
            self.dataset.append(
                {'title':extension_name,
                'description':extension_description})
        source_handle.close()
    def print_perl(self):
        print("[\n")
        for i in self.dataset:
            print("\t{\n\t\ttitle => \"%s\",\n\t\tdescription => \"%s\"\n\t}," % ( i['title'], i['description'] ))
        print("]")

    def print_json(self):
        print(simplejson.dumps(self.dataset))

    def print_text(self):
        for i in self.dataset:
            print("%s=%s" % ( i['title'], i['description'] ))

def usage():
    print('')
    print('Usage: ' + sys.argv[0] + ' [OPTIONS]')
    print('Options:')
    print('')
    print(' -p | --perl   : return perl-compartible structure')
    print(' -j | --json   : return json structure')
    print(' -s | --source : specify source file (by default /etc/cl.selector/phpextdesc.txt')
    print(' -h | --help   : print this message')
    print('By default data is outputted as colon separated text')
    print('')

def main():

    config = {}
    config['perl'] = False
    config['json'] = False
    config['source'] = '/etc/cl.selector/phpextdesc.txt'

    try:
        opts, args = getopt.getopt( sys.argv[1:], 'hpjs:', [ 'help', 'perl', 'json', 'source=' ] )
    except getopt.GetoptError:
        usage()
        sys.exit(1)

    for o, a in opts:
        if o in [ '-h', '--help' ]:
            usage()
        elif o in [ '-s', '--source' ]:
            config['xmlsource'] = a
        elif o in [ '-p', '--perl' ]:
            config['perl'] = True
        elif o in [ '-j', '--json' ]:
            config['json'] = True

    xml_doc = ParseText(config['source'])
    if config['perl'] and not config['json']:
        xml_doc.print_perl()
    elif config['json']:
        xml_doc.print_json()
    else:
        xml_doc.print_text()


if __name__ == '__main__':
    main()