mufeedvh / code2prompt

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.
MIT License
1.54k stars 86 forks source link

Cannot copy to clipboard on Ubuntu 24.04 #39

Open tallesl opened 1 week ago

tallesl commented 1 week ago

I'm using the v1.1.0 binary from the release section.

Here's a workaround:

$ code2prompt -o /dev/stdout my-folder/ | xclip -selection c
Mavial commented 4 days ago

Issue persists in v2.0.0.

Theoabw commented 23 hours ago

I made a workaround with ChatGPT. It's just a custom script that uses a temporary output file and uses cat to get it to the clipboard with xclip. https://chatgpt.com/share/66eadf1d-ab08-8003-8c10-385f1b4be36b

#!/bin/bash

# Create a temporary file
TMPFILE=$(mktemp)

# Run code2prompt with the provided options and save the output directly to the temp file using -o option
code2prompt "$@" -o "$TMPFILE"

# Output the contents of the file and pipe to xclip (clipboard)
cat "$TMPFILE" | xclip -selection clipboard

# Delete the temporary file
rm "$TMPFILE"

echo "Prompt copied to clipboard."