gitex 0.2.16__tar.gz → 0.2.18__tar.gz
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.
- {gitex-0.2.16 → gitex-0.2.18}/PKG-INFO +1 -1
- gitex-0.2.18/gitex/__init__.py +1 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/main.py +8 -9
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/PKG-INFO +1 -1
- {gitex-0.2.16 → gitex-0.2.18}/tests/test_cli.py +43 -3
- {gitex-0.2.16 → gitex-0.2.18}/tests/test_fences.py +2 -2
- {gitex-0.2.16 → gitex-0.2.18}/tests/test_skip_binaries.py +2 -3
- gitex-0.2.16/gitex/__init__.py +0 -1
- {gitex-0.2.16 → gitex-0.2.18}/README.md +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/dependency_mapper.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/docstring_extractor.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/models.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/picker/__init__.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/picker/base.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/picker/questionary.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/picker/textuals.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/renderer.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex/utils.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/SOURCES.txt +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/dependency_links.txt +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/entry_points.txt +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/requires.txt +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/gitex.egg-info/top_level.txt +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/pyproject.toml +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/setup.cfg +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/tests/test_render.py +0 -0
- {gitex-0.2.16 → gitex-0.2.18}/tests/test_textual.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.18"
|
|
@@ -37,8 +37,8 @@ def _filter_nodes(nodes):
|
|
|
37
37
|
help="Launch interactive picker to choose files")
|
|
38
38
|
@click.option("--no-files", is_flag=True,
|
|
39
39
|
help="Only render the directory tree without file contents.")
|
|
40
|
-
@click.option("-
|
|
41
|
-
help="
|
|
40
|
+
@click.option("-v", "--verbose", is_flag=True,
|
|
41
|
+
help="Print output to terminal in addition to copying.")
|
|
42
42
|
@click.option("-d", "--base-dir", default=None,
|
|
43
43
|
help="Strip this prefix from file paths when rendering file contents.")
|
|
44
44
|
@click.option("-ds", "--extract-docstrings", "extract_symbol",
|
|
@@ -54,7 +54,7 @@ def _filter_nodes(nodes):
|
|
|
54
54
|
@click.option("--force", is_flag=True, help="Force execution on non-git directories (caution: may be slow).")
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
def cli(path, interactive, no_files,
|
|
57
|
+
def cli(path, interactive, no_files, verbose, base_dir, extract_symbol, include_empty_classes, dependency_focus, ignore_gitignore, show_hidden, force):
|
|
58
58
|
"""
|
|
59
59
|
Renders a repository's file tree and optional file contents for LLM prompts.
|
|
60
60
|
|
|
@@ -140,14 +140,13 @@ def cli(path, interactive, no_files, copy_clipboard, base_dir, extract_symbol, i
|
|
|
140
140
|
|
|
141
141
|
final_output = "".join(out_parts)
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
else:
|
|
148
|
-
click.secho("[Failed to copy to clipboard – install wl-clipboard or xclip or xsel]", fg="yellow", err=True)
|
|
143
|
+
ok = copy_to_clipboard(final_output)
|
|
144
|
+
if ok:
|
|
145
|
+
click.secho("[Copied to clipboard]", err=True)
|
|
146
|
+
if verbose:
|
|
149
147
|
click.echo(final_output)
|
|
150
148
|
else:
|
|
149
|
+
click.secho("[Failed to copy to clipboard – install wl-clipboard or xclip or xsel]", fg="yellow", err=True)
|
|
151
150
|
click.echo(final_output)
|
|
152
151
|
|
|
153
152
|
if __name__ == "__main__":
|
|
@@ -2,6 +2,7 @@ import shutil
|
|
|
2
2
|
import tempfile
|
|
3
3
|
import unittest
|
|
4
4
|
from pathlib import Path
|
|
5
|
+
from unittest.mock import patch
|
|
5
6
|
|
|
6
7
|
from click.testing import CliRunner
|
|
7
8
|
from git import Repo
|
|
@@ -42,11 +43,15 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
42
43
|
# Should NOT output the file content to stdout
|
|
43
44
|
self.assertNotIn("content inside non-git dir", result.stdout)
|
|
44
45
|
|
|
45
|
-
|
|
46
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
47
|
+
def test_non_git_repo_force(self, mock_copy):
|
|
46
48
|
"""
|
|
47
49
|
Test that using the --force flag allows gitex to run
|
|
48
50
|
on a non-git directory.
|
|
49
51
|
"""
|
|
52
|
+
# Simulate copy failure so it prints to stdout by default fallback
|
|
53
|
+
mock_copy.return_value = False
|
|
54
|
+
|
|
50
55
|
p = Path(self.test_dir) / "forced_file.txt"
|
|
51
56
|
p.write_text("forced content", encoding="utf-8")
|
|
52
57
|
|
|
@@ -76,10 +81,14 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
76
81
|
self.assertIn("Skipping", result.stderr)
|
|
77
82
|
self.assertNotIn("secret", result.stdout)
|
|
78
83
|
|
|
79
|
-
|
|
84
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
85
|
+
def test_valid_git_repo(self, mock_copy):
|
|
80
86
|
"""
|
|
81
87
|
Test that gitex runs automatically on a valid git repository.
|
|
82
88
|
"""
|
|
89
|
+
# Simulate copy failure to ensure output falls back to stdout
|
|
90
|
+
mock_copy.return_value = False
|
|
91
|
+
|
|
83
92
|
Repo.init(self.test_dir)
|
|
84
93
|
|
|
85
94
|
p = Path(self.test_dir) / "repo_file.py"
|
|
@@ -89,6 +98,9 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
89
98
|
|
|
90
99
|
self.assertEqual(result.exit_code, 0)
|
|
91
100
|
self.assertNotIn("Skipping", result.stderr)
|
|
101
|
+
|
|
102
|
+
# Verify fallback message
|
|
103
|
+
self.assertIn("Failed to copy", result.stderr)
|
|
92
104
|
|
|
93
105
|
self.assertIn("repo_file.py", result.stdout)
|
|
94
106
|
|
|
@@ -97,6 +109,34 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
97
109
|
self.assertIn("print('hello git')", result.stdout)
|
|
98
110
|
self.assertIn("```", result.stdout)
|
|
99
111
|
|
|
112
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
113
|
+
def test_clipboard_success_silent(self, mock_copy):
|
|
114
|
+
"""Test default behavior: copy succeeds, stdout is silent."""
|
|
115
|
+
mock_copy.return_value = True
|
|
116
|
+
Repo.init(self.test_dir)
|
|
117
|
+
p = Path(self.test_dir) / "file.txt"
|
|
118
|
+
p.write_text("data", encoding="utf-8")
|
|
119
|
+
|
|
120
|
+
result = self.runner.invoke(cli, [self.test_dir])
|
|
121
|
+
|
|
122
|
+
self.assertEqual(result.exit_code, 0)
|
|
123
|
+
self.assertIn("[Copied to clipboard]", result.stderr)
|
|
124
|
+
self.assertEqual("", result.stdout)
|
|
125
|
+
|
|
126
|
+
@patch("gitex.main.copy_to_clipboard")
|
|
127
|
+
def test_clipboard_success_verbose(self, mock_copy):
|
|
128
|
+
"""Test verbose behavior: copy succeeds, stdout prints content."""
|
|
129
|
+
mock_copy.return_value = True
|
|
130
|
+
Repo.init(self.test_dir)
|
|
131
|
+
p = Path(self.test_dir) / "file.txt"
|
|
132
|
+
p.write_text("data", encoding="utf-8")
|
|
133
|
+
|
|
134
|
+
result = self.runner.invoke(cli, [self.test_dir, "-v"])
|
|
135
|
+
|
|
136
|
+
self.assertEqual(result.exit_code, 0)
|
|
137
|
+
self.assertIn("[Copied to clipboard]", result.stderr)
|
|
138
|
+
self.assertIn("data", result.stdout)
|
|
139
|
+
|
|
100
140
|
def test_help_short_flag(self):
|
|
101
141
|
result = self.runner.invoke(cli, ["-h"])
|
|
102
142
|
|
|
@@ -104,4 +144,4 @@ class TestGitExCLI(unittest.TestCase):
|
|
|
104
144
|
self.assertIn("Usage:", result.output)
|
|
105
145
|
|
|
106
146
|
if __name__ == "__main__":
|
|
107
|
-
unittest.main()
|
|
147
|
+
unittest.main()
|
|
@@ -81,7 +81,7 @@ def repo_dir(tmp_path: Path):
|
|
|
81
81
|
def run_gitex(runner: CliRunner, repo_dir: Path):
|
|
82
82
|
return runner.invoke(
|
|
83
83
|
cli,
|
|
84
|
-
[str(repo_dir)],
|
|
84
|
+
[str(repo_dir), "-v"], # Added -v to force output to stdout
|
|
85
85
|
catch_exceptions=False, # IMPORTANT
|
|
86
86
|
)
|
|
87
87
|
|
|
@@ -167,4 +167,4 @@ def test_language_tags_for_known_files(runner, repo_dir):
|
|
|
167
167
|
for fname, lang in expected.items():
|
|
168
168
|
block = extract_block(result.stdout, fname)
|
|
169
169
|
first = block.splitlines()[0]
|
|
170
|
-
assert first.endswith(lang), f"{fname} expected lang '{lang}', got {first!r}"
|
|
170
|
+
assert first.endswith(lang), f"{fname} expected lang '{lang}', got {first!r}"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# tests/test_skip_binaries.py
|
|
2
1
|
import re
|
|
3
2
|
from pathlib import Path
|
|
4
3
|
|
|
@@ -35,7 +34,7 @@ def repo_dir(tmp_path: Path):
|
|
|
35
34
|
def run_gitex(runner: CliRunner, repo_dir: Path):
|
|
36
35
|
return runner.invoke(
|
|
37
36
|
cli,
|
|
38
|
-
[str(repo_dir)],
|
|
37
|
+
[str(repo_dir), "-v"], # Added -v to force output to stdout
|
|
39
38
|
catch_exceptions=False, # IMPORTANT
|
|
40
39
|
)
|
|
41
40
|
|
|
@@ -66,4 +65,4 @@ def test_text_file_is_rendered_normally(runner, repo_dir):
|
|
|
66
65
|
result = run_gitex(runner, repo_dir)
|
|
67
66
|
assert result.exit_code == 0
|
|
68
67
|
assert "# hello.txt\n" in result.stdout
|
|
69
|
-
assert "hello\n" in result.stdout
|
|
68
|
+
assert "hello\n" in result.stdout
|
gitex-0.2.16/gitex/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.16"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|