Added --verbose option to create command
This commit is contained in:
parent
0ba0ca63d4
commit
aff6657980
|
@ -2,6 +2,7 @@
|
|||
|
||||
* Remove the --force option. Local files are now never overwritten.
|
||||
* Added option alias -v for --verbose.
|
||||
* Added --verbose option to create command.
|
||||
|
||||
0.5 "Vanishing Point" (released 4.3.2010)
|
||||
|
||||
|
|
18
doc/patool.1
18
doc/patool.1
|
@ -15,8 +15,8 @@
|
|||
.SH NAME
|
||||
patool - simple manager for file archives of various types
|
||||
.SH SYNOPSIS
|
||||
\fBpatool\fP (\fBextract\fP|\fBlist\fP|\fBtest\fP) [\fIoptions\fP] <\fIarchive-file\fP>
|
||||
\fBpatool\fP \fBcreate\fP [\fIoptions\fP] <\fIarchive-file\fP> [\fIfiles\fP..]
|
||||
\fBpatool\fP (\fBextract\fP|\fBlist\fP|\fBtest\fP) [\fIoptions\fP] <\fIarchive-file\fP>...
|
||||
\fBpatool\fP \fBcreate\fP [\fIoptions\fP] <\fIarchive-file\fP> [\fIfiles\fP...]
|
||||
\fBpatool\fP \fBformats\fP [\fIoptions\fP]
|
||||
.SH DESCRIPTION
|
||||
Various archive types can be created, extracted, tested and listed by
|
||||
|
@ -32,6 +32,11 @@ RPM (.rpm), DEB (.deb), LZIP (.lz), LZOP (.lzo), LZMA (.lzma), RAR (.rar)
|
|||
and XZ (.xz) formats.
|
||||
It relies on helper applications to handle those archive formats
|
||||
(for example bzip2 for BZIP2 archives).
|
||||
.SH EXAMPLES
|
||||
\fBpatool extract archive.zip\fP
|
||||
\fBpatool test --verbose dist.tar.gz\fP
|
||||
\fBpatool list package.deb\fP
|
||||
\fPpatool create --verbose myfiles.zip file1.txt dir/\fP
|
||||
.SH COMMANDS
|
||||
Several commands and options are available.
|
||||
.SS \fBextract\fP
|
||||
|
@ -60,10 +65,11 @@ Verbose archive listing (if the helper application supports it).
|
|||
\fB\-\-help\fP
|
||||
Show help for this command.
|
||||
.SS \fBcreate\fP
|
||||
Create an archive from given files.
|
||||
.\" .TP
|
||||
.\" \fB\-v\fP, \fB\-\-verbose\fP
|
||||
.\" Verbose operation (if the helper application supports it).
|
||||
Create an archive from given files. At least on of the given files to add
|
||||
to the archive has to exist.
|
||||
.TP
|
||||
\fB\-v\fP, \fB\-\-verbose\fP
|
||||
Verbose operation (if the helper application supports it).
|
||||
.TP
|
||||
\fB\-\-help\fP
|
||||
Show help for this command.
|
||||
|
|
|
@ -6,8 +6,8 @@ NAME
|
|||
patool - simple manager for file archives of various types
|
||||
|
||||
SYNOPSIS
|
||||
patool (extract|list|test) [options] <archive-file>
|
||||
patool create [options] <archive-file> [files..]
|
||||
patool (extract|list|test) [options] <archive-file>...
|
||||
patool create [options] <archive-file> [files...]
|
||||
patool formats [options]
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -24,6 +24,12 @@ DESCRIPTION
|
|||
and XZ (.xz) formats. It relies on helper applications to handle those
|
||||
archive formats (for example bzip2 for BZIP2 archives).
|
||||
|
||||
EXAMPLES
|
||||
patool extract archive.zip
|
||||
patool test --verbose dist.tar.gz
|
||||
patool list package.deb
|
||||
patool create --verbose myfiles.zip file1.txt dir/
|
||||
|
||||
COMMANDS
|
||||
Several commands and options are available.
|
||||
|
||||
|
@ -52,7 +58,11 @@ COMMANDS
|
|||
--help Show help for this command.
|
||||
|
||||
create
|
||||
Create an archive from given files.
|
||||
Create an archive from given files. At least on of the given files to
|
||||
add to the archive has to exist.
|
||||
|
||||
-v, --verbose
|
||||
Verbose operation (if the helper application supports it).
|
||||
|
||||
--help Show help for this command.
|
||||
|
||||
|
|
9
patool
9
patool
|
@ -38,10 +38,13 @@ def list (archive, verbose=False):
|
|||
return handle_archive(archive, 'list')
|
||||
|
||||
|
||||
@baker.command
|
||||
def create (archive, *args):
|
||||
@baker.command(shortopts={"verbose": "v"}, params={
|
||||
"verbose": "Verbose archive listing (if the helper application supports it).",
|
||||
})
|
||||
def create (archive, file1, *files, **kwargs):
|
||||
"""Create an archive from given files."""
|
||||
return handle_archive(archive, 'create', *args)
|
||||
allfiles = (file1,)+files
|
||||
return handle_archive(archive, 'create', *allfiles, **kwargs)
|
||||
|
||||
|
||||
@baker.command(shortopts={"verbose": "v"}, params={
|
||||
|
|
|
@ -47,6 +47,7 @@ class ArchiveTest (unittest.TestCase):
|
|||
os.chdir(tmpdir)
|
||||
try:
|
||||
patoolib._handle_archive(archive, 'extract', program=self.program)
|
||||
patoolib._handle_archive(archive, 'extract', program=self.program, verbose=True)
|
||||
finally:
|
||||
os.chdir(basedir)
|
||||
shutil.rmtree(tmpdir)
|
||||
|
@ -70,10 +71,6 @@ class ArchiveTest (unittest.TestCase):
|
|||
topack = os.path.join(datadir, 'foo.txt')
|
||||
else:
|
||||
topack = os.path.join(datadir, 'foo')
|
||||
# create a temporary directory for creation
|
||||
tmpdir = patoolib.util.tmpdir(dir=basedir)
|
||||
archive = os.path.join(tmpdir, filename)
|
||||
os.chdir(tmpdir)
|
||||
# The format and encoding arguments are needed for creating
|
||||
# archives with unusual file extensions.
|
||||
kwargs = dict(
|
||||
|
@ -81,6 +78,16 @@ class ArchiveTest (unittest.TestCase):
|
|||
format=format,
|
||||
encoding=encoding
|
||||
)
|
||||
self._archive_create(filename, topack, kwargs)
|
||||
kwargs['verbose'] = True
|
||||
self._archive_create(filename, topack, kwargs)
|
||||
|
||||
def _archive_create (self, filename, topack, kwargs):
|
||||
"""Create archive from filename."""
|
||||
# create a temporary directory for creation
|
||||
tmpdir = patoolib.util.tmpdir(dir=basedir)
|
||||
archive = os.path.join(tmpdir, filename)
|
||||
os.chdir(tmpdir)
|
||||
try:
|
||||
patoolib._handle_archive(archive, 'create', topack, **kwargs)
|
||||
# not all programs can test what they create
|
||||
|
|
Loading…
Reference in New Issue