def getInfo(): return lz4tools.getFileInfo(res.input)
help='Optional output target.') if len(sys.argv) == 1: parser.print_help() sys.exit() res = parser.parse_args() #print('blockSizeId: {}'.format(res.blkSizeId)) prefs = lz4tools.lz4f.makePrefs(res.blkSizeId, res.blkMode) compFile = lambda: lz4tools.compressFileDefault( res.input, outname=res.output, prefs=prefs) compDir = lambda: lz4tools.compressTarDefault( res.input, outname=res.output, prefs=prefs) decompFile = lambda: lz4tools.decompressFileDefault(res.input, outname=res.output) getInfo = lambda: lz4tools.getFileInfo(res.input) outErr = lambda: sys.stdout.write( 'Please specify only ony of the comp/decomp options') if res.info: print(getInfo()) elif res.file: if res.tar or res.decomp: outErr() compFile() elif res.tar: if res.decomp: outErr() compDir() elif res.input.endswith('lz4'): decompFile()
choices=[0, 1]) parser.add_argument('input', action='store', help='The targeted input.') parser.add_argument('output', action='store', nargs='?', default=None, help='Optional output target.') if len(sys.argv) == 1: parser.print_help() sys.exit() res = parser.parse_args() #print('blockSizeId: {}'.format(res.blkSizeId)) prefs = lz4tools.lz4f.makePrefs(res.blkSizeId, res.blkMode) compFile = lambda: lz4tools.compressFileDefault(res.input, outname=res.output, prefs=prefs) compDir = lambda: lz4tools.compressTarDefault(res.input, outname=res.output, prefs=prefs) decompFile = lambda: lz4tools.decompressFileDefault(res.input, outname=res.output) getInfo = lambda: lz4tools.getFileInfo(res.input) outErr = lambda: sys.stdout.write('Please specify only ony of the comp/decomp options') if res.info: print(getInfo()) elif res.file: if res.tar or res.decomp: outErr() compFile() elif res.tar: if res.decomp: outErr() compDir() elif res.input.endswith('lz4'): decompFile() elif os.path.isfile(res.input):