file_query_text 0.1.4__py3-none-any.whl → 0.1.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- file_query_text/__init__.py +1 -1
- file_query_text/cli.py +14 -1
- file_query_text/main.py +13 -1
- {file_query_text-0.1.4.dist-info → file_query_text-0.1.6.dist-info}/METADATA +1 -1
- file_query_text-0.1.6.dist-info/RECORD +9 -0
- file_query_text-0.1.4.dist-info/RECORD +0 -9
- {file_query_text-0.1.4.dist-info → file_query_text-0.1.6.dist-info}/WHEEL +0 -0
- {file_query_text-0.1.4.dist-info → file_query_text-0.1.6.dist-info}/entry_points.txt +0 -0
- {file_query_text-0.1.4.dist-info → file_query_text-0.1.6.dist-info}/top_level.txt +0 -0
file_query_text/__init__.py
CHANGED
file_query_text/cli.py
CHANGED
@@ -5,6 +5,7 @@ import argparse
|
|
5
5
|
from pathlib import Path
|
6
6
|
# Fix imports to work when installed as a package
|
7
7
|
from file_query_text.main import parse_query, QueryVisitor, execute_query, get_file_attributes
|
8
|
+
from file_query_text import __version__
|
8
9
|
|
9
10
|
def main():
|
10
11
|
parser = argparse.ArgumentParser(description="SQL-like queries for your filesystem")
|
@@ -25,6 +26,17 @@ def main():
|
|
25
26
|
action="store_true",
|
26
27
|
help="Don't respect .gitignore files (show ignored files)"
|
27
28
|
)
|
29
|
+
parser.add_argument(
|
30
|
+
"--show-hidden", "-s",
|
31
|
+
action="store_true",
|
32
|
+
help="Show hidden files (starting with a dot)"
|
33
|
+
)
|
34
|
+
parser.add_argument(
|
35
|
+
"--version", "-v",
|
36
|
+
action="version",
|
37
|
+
version=f"file_query_text {__version__}",
|
38
|
+
help="Show the version and exit"
|
39
|
+
)
|
28
40
|
args = parser.parse_args()
|
29
41
|
|
30
42
|
# Get current working directory for the query
|
@@ -54,7 +66,8 @@ def main():
|
|
54
66
|
visitor.select,
|
55
67
|
visitor.from_dirs,
|
56
68
|
visitor.where,
|
57
|
-
respect_gitignore=not args.no_gitignore
|
69
|
+
respect_gitignore=not args.no_gitignore,
|
70
|
+
show_hidden=args.show_hidden
|
58
71
|
)
|
59
72
|
|
60
73
|
# Display results
|
file_query_text/main.py
CHANGED
@@ -31,7 +31,7 @@ class QueryVisitor:
|
|
31
31
|
self.from_dirs = parsed_query.get("from_dirs", [])
|
32
32
|
self.where = parsed_query.get("where", None)
|
33
33
|
|
34
|
-
def execute_query(select, from_dirs, where_conditions, respect_gitignore=True):
|
34
|
+
def execute_query(select, from_dirs, where_conditions, respect_gitignore=True, show_hidden=False):
|
35
35
|
matched_files = []
|
36
36
|
|
37
37
|
# Set up gitignore matching if requested
|
@@ -63,6 +63,18 @@ def execute_query(select, from_dirs, where_conditions, respect_gitignore=True):
|
|
63
63
|
for filename in files:
|
64
64
|
file_path = os.path.join(root, filename)
|
65
65
|
|
66
|
+
# Skip hidden files or files in hidden directories unless explicitly requested
|
67
|
+
if not show_hidden:
|
68
|
+
# Check if file name starts with dot
|
69
|
+
if os.path.basename(file_path).startswith('.'):
|
70
|
+
continue
|
71
|
+
|
72
|
+
# Check if any parent directory starts with dot
|
73
|
+
rel_path = os.path.relpath(file_path, directory)
|
74
|
+
path_parts = rel_path.split(os.sep)
|
75
|
+
if any(part.startswith('.') for part in path_parts[:-1]): # Check all except the filename
|
76
|
+
continue
|
77
|
+
|
66
78
|
# Check if file is ignored by gitignore rules
|
67
79
|
if respect_gitignore:
|
68
80
|
# Find which repo this file belongs to
|
@@ -0,0 +1,9 @@
|
|
1
|
+
file_query_text/__init__.py,sha256=kJ33So_6rzvtBPQOQZaG0-_cw6mbIzuaRqzw8lY2AbI,89
|
2
|
+
file_query_text/cli.py,sha256=eijCT1pHk4wtBhhmFHyeTOoLNz0zwk7Bm4izRLrjZb4,3709
|
3
|
+
file_query_text/grammar.py,sha256=XanSi9VCKuIQNlOMXRBZbeWxaJj2UhMJPDIYKgw4lEQ,1655
|
4
|
+
file_query_text/main.py,sha256=YUdNijSm_iIcb2rkdKtDsE0Jl2tVbGi0J3G-bSO5_J0,7024
|
5
|
+
file_query_text-0.1.6.dist-info/METADATA,sha256=CUk07ZjACLMQCO_EdQ076ChtqtifqdITEZFtIOYM_sY,2480
|
6
|
+
file_query_text-0.1.6.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
7
|
+
file_query_text-0.1.6.dist-info/entry_points.txt,sha256=rNFYWzvcIsUZkGNsc_E_B5HyYRnqqdj_u8_IeQpw1wo,48
|
8
|
+
file_query_text-0.1.6.dist-info/top_level.txt,sha256=o1FzSvLa6kSV61b7RLHWRhEezc96m05YwIKqjuWUSxU,16
|
9
|
+
file_query_text-0.1.6.dist-info/RECORD,,
|
@@ -1,9 +0,0 @@
|
|
1
|
-
file_query_text/__init__.py,sha256=RtXk4T4ak476yGSYu2rV0NLWYC6hu4Mfb6gFdVcwlmI,89
|
2
|
-
file_query_text/cli.py,sha256=z1e16emuXsgsJP298UKbezhtIVMx9NZQ6v7FNHAahoo,3306
|
3
|
-
file_query_text/grammar.py,sha256=XanSi9VCKuIQNlOMXRBZbeWxaJj2UhMJPDIYKgw4lEQ,1655
|
4
|
-
file_query_text/main.py,sha256=PVUQ6BZsvN2eEUhORjWr2aNh761evNieOaXTs_RDlB4,6377
|
5
|
-
file_query_text-0.1.4.dist-info/METADATA,sha256=HdJD2CkT8EYd7d3YD7ewdeid3SZF_o5pbHDOzMWUKE4,2480
|
6
|
-
file_query_text-0.1.4.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
7
|
-
file_query_text-0.1.4.dist-info/entry_points.txt,sha256=rNFYWzvcIsUZkGNsc_E_B5HyYRnqqdj_u8_IeQpw1wo,48
|
8
|
-
file_query_text-0.1.4.dist-info/top_level.txt,sha256=o1FzSvLa6kSV61b7RLHWRhEezc96m05YwIKqjuWUSxU,16
|
9
|
-
file_query_text-0.1.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|