patool/patool

51 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Bastian Kleineidam
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
patool [extract|list] [sub-command-options] <archive-file>
"""
import sys
if not hasattr(sys, "version_info") or sys.version_info < (2, 5, 0, "final", 0):
raise SystemExit("Error, this script needs Python >= 2.5 installed")
import baker
import patoolib
@baker.command
def extract (archive, verbose=False, force=False):
"""Extract files from an archive."""
return patoolib.handle_archive(archive, 'extract')
@baker.command
def list (archive, verbose=False):
"""List files in an archive."""
return patoolib.handle_archive(archive, 'list')
#@baker.command
#def create (archive, *args):
# """Create an archive from given files."""
# return patoolib.handle_archive(archive, 'create', *args)
@baker.command
def formats ():
return patoolib.list_formats()
sys.exit(baker.run())