kojix2 / chatgpt-cli

Yet another ChatGPT command line tool
https://kojix2.github.io/chatgpt-cli/
MIT License
25 stars 1 forks source link

Support for Clipboards #6

Closed kojix2 closed 10 months ago

kojix2 commented 1 year ago

Clipboard support is necessary, but Crystal does not have a rich library for it, making it very difficult to support cross-platform clipboard without a library. Therefore, we are considering using a command to execute clipboard functions. For instance, on Linux, using 'xsel' would make it easy to use the clipboard. However, this method does not always work well when placed at the beginning of a command because it is interpreted as a command to be executed, due to it starting with '!'. Implementing exceptions can make it hard to maintain consistency in the configuration file.

kojix2 commented 10 months ago

The clipboard was supported in the following way. This is simple and easy to maintain. People who try to use chatgpt on the terminal must love the command line interface, So it is expected that they have xsel installed.

https://github.com/kojix2/chatgpt-cli/blob/44fa8a08f5fd139ff0ab1b10dc880fcad458c828/src/chatgpt/magic/copy.cr#L18C1-L38C10