Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ctxify"
version = "0.1.6"
version = "0.1.7"
description = "A tool to print git repository files with tree structure"
readme = "README.md"
requires-python = ">=3.8"
Expand Down
2 changes: 1 addition & 1 deletion src/ctxify/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.6'
__version__ = '0.1.7'
28 changes: 18 additions & 10 deletions src/ctxify/main.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import platform
import subprocess
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union

from prompt_toolkit import PromptSession
from prompt_toolkit.completion import FuzzyWordCompleter
import platform

# Files/extensions to skip (non-code files) for content inclusion
NON_CODE_PATTERNS = {
IGNORE_FILES = {
'package-lock.json',
'poetry.lock',
'uv.lock',
Expand All @@ -22,6 +22,10 @@
'LICENSE',
'CHANGELOG',
'CONTRIBUTING',
'.env', # Added to explicitly ignore .env files
}

IGNORE_EXTENSIONS = {
'.json',
'.yaml',
'.yml',
Expand Down Expand Up @@ -121,8 +125,8 @@ def get_git_files(
f
for f in dir_files
if not (
f in NON_CODE_PATTERNS
or any(f.endswith(ext) for ext in NON_CODE_PATTERNS)
f in IGNORE_FILES
or any(f.endswith(ext) for ext in IGNORE_EXTENSIONS)
or (not include_md and (f.endswith('.md') or 'README' in f))
)
]
Expand All @@ -138,12 +142,12 @@ def copy_to_clipboard(text: str) -> bool:
system = platform.system().lower()
try:
if system == 'darwin': # macOS
subprocess.run(
['pbcopy'], input=text.encode('utf-8'), check=True
)
subprocess.run(['pbcopy'], input=text.encode('utf-8'), check=True)
elif system == 'linux': # Linux
subprocess.run(
['xclip', '-selection', 'clipboard'], input=text.encode('utf-8'), check=True
['xclip', '-selection', 'clipboard'],
input=text.encode('utf-8'),
check=True,
)
else:
print(f'Warning: Clipboard operations not supported on {platform.system()}')
Expand All @@ -155,9 +159,13 @@ def copy_to_clipboard(text: str) -> bool:
return False
except FileNotFoundError:
if system == 'darwin':
print("Warning: pbcopy not found. This is unexpected as it should be built into macOS")
print(
'Warning: pbcopy not found. This is unexpected as it should be built into macOS'
)
else:
print("Warning: xclip not installed. Install it with 'sudo apt install xclip'")
print(
"Warning: xclip not installed. Install it with 'sudo apt install xclip'"
)
return False


Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.