Major UI update
This commit is contained in:
47
claude.sh
47
claude.sh
@@ -1,16 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Parse command line arguments
|
||||
target_dir="." # Default to current directory
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
-d|--directory)
|
||||
if [ -n "$2" ] && [ -d "$2" ]; then
|
||||
target_dir="$2"
|
||||
shift 2
|
||||
else
|
||||
echo "Error: Directory '$2' does not exist or is not specified" >&2
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 [-d|--directory <path>]" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Change to target directory while storing original directory
|
||||
original_dir=$(pwd)
|
||||
cd "$target_dir" || exit 1
|
||||
|
||||
# Clear/create output file
|
||||
> claude.txt
|
||||
output_file="$original_dir/claude.txt"
|
||||
> "$output_file"
|
||||
|
||||
# Generate and add directory tree
|
||||
echo "Directory Tree:" > claude.txt
|
||||
echo "=============" >> claude.txt
|
||||
echo "Directory Tree:" > "$output_file"
|
||||
echo "=============" >> "$output_file"
|
||||
# Use tree with gitignore patterns
|
||||
tree -I "$(git check-ignore * .*)" >> claude.txt
|
||||
tree -I "$(git check-ignore * .*)" >> "$output_file"
|
||||
|
||||
echo -e "\nFile Contents:" >> claude.txt
|
||||
echo "=============" >> claude.txt
|
||||
echo -e "\nFile Contents:" >> "$output_file"
|
||||
echo "=============" >> "$output_file"
|
||||
|
||||
# Use git ls-files to get tracked files and untracked files that aren't ignored
|
||||
# The --exclude-standard flag makes git ls-files respect .gitignore
|
||||
@@ -22,7 +47,6 @@ echo "=============" >> claude.txt
|
||||
if [ "$file" = "claude.txt" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip non-existent files
|
||||
if [ ! -f "$file" ]; then
|
||||
continue
|
||||
@@ -34,9 +58,12 @@ echo "=============" >> claude.txt
|
||||
continue
|
||||
fi
|
||||
|
||||
echo -e "\n=== File: $file ===" >> claude.txt
|
||||
echo -e "------------------------" >> claude.txt
|
||||
cat "$file" >> claude.txt
|
||||
echo -e "\n=== File: $file ===" >> "$output_file"
|
||||
echo -e "------------------------" >> "$output_file"
|
||||
cat "$file" >> "$output_file"
|
||||
done
|
||||
|
||||
# Return to original directory
|
||||
cd "$original_dir" || exit 1
|
||||
|
||||
echo "Concatenation complete. Output written to claude.txt"
|
||||
Reference in New Issue
Block a user