Search by pattern, search for file names(including extension) with fnmatch module, support for Unix shell-style wildcards #113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes related to previous discussions.
Search by other criteria:
#88
Search by pattern also allows you to search for several similar extensions(partially):
#92
added def search_files_by_pattern
search for file names(including extension) using Unix shell-style wildcards:
*
,?
,[seq]
,[!seq]
;used
fnmatch.fnmatch(filename, pattern)
andfnmatch.fnmatchcase(filename, pattern)
from PSL https://docs.python.org/3/library/fnmatch.html;result is a generator with full paths.
added new argument
--filename-match PATTERN
as part of parser search groupif you use this argument, common args and special search group arguments are available (
preview
,previw-size
,file-sizes
);except for the
--file-extension
argument, which is used separately;preview behavior is similar to --file-extension .. (all extensions),
in this case, the preview will only be displayed for files with a supported extension.
updated help_text, start message for CLI, SUPPORTED_TYPE_INFO_MESSAGE
added test
Examples:
count-files --filename-match *test*
returns files with word test in filenamecount-files --filename-match setup.py
returns exact filecount-files --filename-match *.py?
returns files with extensions.pyc
,.pyo
,.pyd
,.pyw
and so on