Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow reading from special files (device, FIFO, etc) #886

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

theasp
Copy link
Contributor

@theasp theasp commented Sep 25, 2024

See: #884

Don't check to see if the filename is a normal file as it will prevent reading from other types of files. Only directories are treated differently.

FIFO:

industrial:~/projects/aichat$ target/debug/aichat -f <(echo I am a banana)
 It seems like you're trying to share some information or engage in a conversation. However, the text "I am a banana" doesn't provide much context for me to respond to
effectively. If you have any specific questions or topics you'd like to discuss, feel free to let me know!

File:

industrial:~/projects/aichat$ target/debug/aichat -f LICENSE-MIT "What license is this?"
 The provided text is the MIT License. Here are some key points about it:
[...]

Device:

industrial:~/projects/aichat$ target/debug/aichat -f /dev/null
 The term `/dev/null` is a special file in Unix-like operating systems, including Linux and macOS. It's often referred to as the "bit bucket" or the "black hole." Here are
some key points about `/dev/null`:
[...]

Directory:

industrial:~/projects/aichat$ target/debug/aichat -f scripts "How many files have you read?"
 Based on the provided files, it appears that you have implemented shell completions and integrations for a command-line tool named `aichat`. The completions are available
for multiple shell environments including PowerShell (`aichat.ps1`), Zsh (`aichat.zsh`), Fish (`aichat.fish`), Bash (`aichat.bash`), and Nushell (`aichat.nu`).
Additionally, there are shell integration scripts for these environments to facilitate real-time interaction with `aichat`.

See: sigoden#884

Don't check to see if the filename is a normal file as it will prevent
reading from other types of files.  Only directories are treated differently.
@sigoden sigoden merged commit 16c5952 into sigoden:main Sep 25, 2024
3 checks passed
@theasp
Copy link
Contributor Author

theasp commented Sep 25, 2024

Thanks!

@theasp theasp deleted the fix-special-files branch September 25, 2024 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants