diff --git a/pyproject.toml b/pyproject.toml index 61594c4..a1a9097 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" diff --git a/src/ctxify/__init__.py b/src/ctxify/__init__.py index 2fb2513..124e462 100644 --- a/src/ctxify/__init__.py +++ b/src/ctxify/__init__.py @@ -1 +1 @@ -__version__ = '0.1.6' +__version__ = '0.1.7' diff --git a/src/ctxify/main.py b/src/ctxify/main.py index 94f01d5..b155140 100644 --- a/src/ctxify/main.py +++ b/src/ctxify/main.py @@ -1,3 +1,4 @@ +import platform import subprocess import sys from pathlib import Path @@ -5,10 +6,9 @@ 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', @@ -22,6 +22,10 @@ 'LICENSE', 'CHANGELOG', 'CONTRIBUTING', + '.env', # Added to explicitly ignore .env files +} + +IGNORE_EXTENSIONS = { '.json', '.yaml', '.yml', @@ -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)) ) ] @@ -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()}') @@ -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 diff --git a/uv.lock b/uv.lock index 3e8dc17..ada7c53 100644 --- a/uv.lock +++ b/uv.lock @@ -25,7 +25,7 @@ wheels = [ [[package]] name = "ctxify" -version = "0.1.5" +version = "0.1.6" source = { editable = "." } dependencies = [ { name = "click" },