Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search by pattern, search for file names(including extension) with fnmatch module, support for Unix shell-style wildcards #113

Merged

Conversation

NataliaBondarenko
Copy link
Collaborator

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) and fnmatch.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 group
    if 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 filename
count-files --filename-match setup.py returns exact file
count-files --filename-match *.py? returns files with extensions .pyc, .pyo, .pyd, .pyw and so on

@victordomingos victordomingos merged commit 05b6290 into victordomingos:master Jan 4, 2020
@victordomingos
Copy link
Owner

Great work you have done here. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants