we now use -P for --prefix and -p for --progress. previously, the
result of -p depended on the command: some were using it for
--progress, some for --prefix. this was confusing and was making it
impossible to both --progress and --prefix with on-letter options
--progress is likely used more often and interactively, so it get the
keystroke shortcut (lower "-p")
--prefix is used more rarely / in scripts, but important/dangerous for
prune, so it get the extra keystroke (higher "-P")
If somebody used -p someprefix and does not fix that to -P, it will
result in "no archive specified" or "unrecognized argument". So it
will neither cause pruning to remove wrong data nor go unnoticed.
Closes: #563
The fnmatch module in Python's standard library implements a pattern
format for paths which is similar to shell patterns. However, “*”
matches any character including path separators. This newly introduced
pattern syntax with the selector “sh” no longer matches the path
separator with “*”. Instead “**/” can be used to match zero or more
directory levels.
There are already three different styles and a fourth will be added.
A definition list is easier to navigate when trying to find the
description of a specific style.
This change implements the functionality requested in issue #361:
extracting files with a given extension. It does so by permitting
patterns to be used instead plain prefix paths. The pattern styles
supported are the same as for exclusions.
The “extract” command supports extracting all files underneath a given
set of prefix paths. The forthcoming support for extracting files using
a pattern (i.e. only files ending in “.zip”) requires the introduction
of path prefixes as a third pattern style, making it also available for
exclusions.
A function to parse pattern specifications was introduced in commit
2bafece. Since then it had a hardcoded default style of “fm”, meaning
fnmatch. With the forthcoming support for extracting files using
patterns this default style must be more flexible.
The utility functions “adjust_patterns” and “exclude_path” produce
respectively use a standard list object containing pattern objects.
With the forthcoming introduction of patterns for filtering files
to be extracted it's better to move the logic of these classes into
a single class.
The wrapper allows adding any number of patterns to an internal list
together with a value to be returned if a match function finds that
one of the patterns matches. A fallback value is returned otherwise.