Make extract the default command; further improve parameter help.
This commit is contained in:
parent
26c455cb39
commit
702a80dbf0
19
doc/patool.1
19
doc/patool.1
|
@ -16,7 +16,7 @@
|
||||||
patool - simple manager for file archives of various types
|
patool - simple manager for file archives of various types
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBpatool\fP (\fBextract\fP|\fBlist\fP|\fBtest\fP) [\fIoptions\fP] <\fIarchive-file\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 \fBcreate\fP [\fIoptions\fP] <\fIarchive-file\fP> [\fIfiles\fP..]
|
||||||
\fBpatool\fP \fBformats\fP [\fIoptions\fP]
|
\fBpatool\fP \fBformats\fP [\fIoptions\fP]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Various archive types can be created, extracted, tested and listed by
|
Various archive types can be created, extracted, tested and listed by
|
||||||
|
@ -35,7 +35,10 @@ It relies on helper applications to handle those archive formats
|
||||||
.SH COMMANDS
|
.SH COMMANDS
|
||||||
Several commands and options are available.
|
Several commands and options are available.
|
||||||
.SS \fBextract\fP
|
.SS \fBextract\fP
|
||||||
Extract files from an archive. Often one wants to extract all files
|
Extract files from an archive. This is the default command if no
|
||||||
|
command was given.
|
||||||
|
.br
|
||||||
|
Often one wants to extract all files
|
||||||
in an archive to a single subdirectory.
|
in an archive to a single subdirectory.
|
||||||
However, some archives contain multiple files in their root
|
However, some archives contain multiple files in their root
|
||||||
directories. The patool program overcomes this problem by
|
directories. The patool program overcomes this problem by
|
||||||
|
@ -61,12 +64,12 @@ Verbose archive listing (if the helper application supports it).
|
||||||
Show help for this command.
|
Show help for this command.
|
||||||
.SS \fBcreate\fP
|
.SS \fBcreate\fP
|
||||||
Create an archive from given files.
|
Create an archive from given files.
|
||||||
.TP
|
.\" .TP
|
||||||
\fB--force\fP
|
.\" \fB--force\fP
|
||||||
Allow overwriting of local archives.
|
.\" Allow overwriting of local archives.
|
||||||
.TP
|
.\" .TP
|
||||||
\fB\-\-verbose\fP
|
.\" \fB\-\-verbose\fP
|
||||||
Verbose operation (if the helper application supports it).
|
.\" Verbose operation (if the helper application supports it).
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-help\fP
|
\fB\-\-help\fP
|
||||||
Show help for this command.
|
Show help for this command.
|
||||||
|
|
|
@ -28,18 +28,20 @@ COMMANDS
|
||||||
Several commands and options are available.
|
Several commands and options are available.
|
||||||
|
|
||||||
extract
|
extract
|
||||||
Extract files from an archive. Often one wants to extract all files in
|
Extract files from an archive. This is the default command if no com‐
|
||||||
an archive to a single subdirectory. However, some archives contain
|
mand was given.
|
||||||
multiple files in their root directories. The patool program overcomes
|
Often one wants to extract all files in an archive to a single subdi‐
|
||||||
this problem by first extracting files to a unique (temporary) direc‐
|
rectory. However, some archives contain multiple files in their root
|
||||||
tory, and then moving its contents back if possible. This also prevents
|
directories. The patool program overcomes this problem by first
|
||||||
local files from being overwritten by mistake.
|
extracting files to a unique (temporary) directory, and then moving its
|
||||||
|
contents back if possible. This also prevents local files from being
|
||||||
|
overwritten by mistake.
|
||||||
|
|
||||||
--force
|
--force
|
||||||
Allow overwriting of local files.
|
Allow overwriting of local files.
|
||||||
|
|
||||||
--verbose
|
--verbose
|
||||||
Be verbose when extracting (if the helper application supports
|
Be verbose when extracting (if the helper application supports
|
||||||
it).
|
it).
|
||||||
|
|
||||||
--help Show help for this command.
|
--help Show help for this command.
|
||||||
|
@ -55,12 +57,6 @@ COMMANDS
|
||||||
create
|
create
|
||||||
Create an archive from given files.
|
Create an archive from given files.
|
||||||
|
|
||||||
--force
|
|
||||||
Allow overwriting of local archives.
|
|
||||||
|
|
||||||
--verbose
|
|
||||||
Verbose operation (if the helper application supports it).
|
|
||||||
|
|
||||||
--help Show help for this command.
|
--help Show help for this command.
|
||||||
|
|
||||||
test
|
test
|
||||||
|
|
19
patool
19
patool
|
@ -22,19 +22,18 @@ if not hasattr(sys, "version_info") or sys.version_info < (2, 4, 0, "final", 0):
|
||||||
raise SystemExit("This program requires Python 2.4 or later.")
|
raise SystemExit("This program requires Python 2.4 or later.")
|
||||||
from patoolib import handle_archive, list_formats, baker
|
from patoolib import handle_archive, list_formats, baker
|
||||||
|
|
||||||
# parameter help
|
@baker.command(default=True, params={
|
||||||
params_force = {"force": "Overwrite files if they exist."}
|
"force": "Allow overwriting of local files.",
|
||||||
params_verbose = {"verbose": "Print verbose output."}
|
"verbose": "Be verbose when extracting (if the helper application supports it)."
|
||||||
params_verbose_force = dict(params_verbose.items() + params_force.items())
|
})
|
||||||
|
|
||||||
|
|
||||||
@baker.command(params=params_verbose_force)
|
|
||||||
def extract (archive, verbose=False, force=False):
|
def extract (archive, verbose=False, force=False):
|
||||||
"""Extract files from archives."""
|
"""Extract files from archives."""
|
||||||
return handle_archive(archive, 'extract')
|
return handle_archive(archive, 'extract')
|
||||||
|
|
||||||
|
|
||||||
@baker.command(params=params_verbose)
|
@baker.command(params={
|
||||||
|
"verbose": "Verbose archive listing (if the helper application supports it).",
|
||||||
|
})
|
||||||
def list (archive, verbose=False):
|
def list (archive, verbose=False):
|
||||||
"""List files in an archive."""
|
"""List files in an archive."""
|
||||||
return handle_archive(archive, 'list')
|
return handle_archive(archive, 'list')
|
||||||
|
@ -46,7 +45,9 @@ def create (archive, *args):
|
||||||
return handle_archive(archive, 'create', *args)
|
return handle_archive(archive, 'create', *args)
|
||||||
|
|
||||||
|
|
||||||
@baker.command(params=params_verbose)
|
@baker.command(params={
|
||||||
|
"verbose": "Verbose operation (if the helper application supports it).",
|
||||||
|
})
|
||||||
def test (archive, verbose=False):
|
def test (archive, verbose=False):
|
||||||
"""Test files in an archive."""
|
"""Test files in an archive."""
|
||||||
return handle_archive(archive, 'test', verbose=verbose)
|
return handle_archive(archive, 'test', verbose=verbose)
|
||||||
|
|
Loading…
Reference in New Issue