import sys, getopt
import vkbeautify as vkb

def main(argv):

    inputfile = ''
    outputfile = ''
    action = False
    ext = 'xml'

    try:
        opts, args = getopt.getopt(argv,"hi:o:a:",["ifile=","ofile=","action="])
    except getopt.GetoptError:
        print('main.py -i <inputfile> -o <outputfile> -a <action>')
        sys.exit(2)
    for opt, arg in opts:
        if opt == '-h':
            print('main.py -i <inputfile> -o <outputfile> -a <action>')
            sys.exit()
        elif opt in ("-i", "--ifile"):
            inputfile = arg
        elif opt in ("-o", "--ofile"):
            outputfile = arg
        elif opt in ("-a", "--action"):
            action = arg

    if not inputfile:
        print('usage: main.py -i <inputfile> -o <outputfile> -a <action>'
               '\ninput file is mandatory')
        sys.exit(2)


    if inputfile[-4:] == '.css':
        if outputfile:
            if action: #minify
                print(vkb.css.min(inputfile, outputfile, True))
            else:
                print(vkb.css(inputfile, outputfile))
        else:
            if action: #minify
                print(vkb.css.min(inputfile, True))
            else:
                print(vkb.css(inputfile))
    else:
        if outputfile:
            if action: #minify
                print(vkb.xml.min(inputfile, outputfile, False))
            else:
                print(vkb.xml(inputfile, outputfile))
        else:
            if action: #minify
                print(vkb.xml.min(inputfile, False))
            else:
                print(vkb.xml(inputfile))

    #print(vkb.file(inputfile, outputfile))

if __name__ =='__main__':
    main(sys.argv[1:])



@@ -116,24 +116,8 @@
 alse
-%0A    ext = 'xml'
 %0A%0A  
@@ -384,36 +384,42 @@
          print('
-main
+usage: app
 .py -i %3Cinputfil
@@ -443,32 +443,141 @@
 %3E -a %3Caction%3E')%0A
+            print('       beautify: no  %3Caction%3E ')%0A            print('       minify:   set %3Caction%3E to 1')%0A%0A
             sys.
@@ -1690,52 +1690,8 @@
 ))%0A%0A
-    #print(vkb.file(inputfile, outputfile))%0A
 %0Aif 

edit cli help