Closed rakusan2 closed 2 years ago
good question
PIped input seems useless to me. ani-cli's main feature is that it's interactive.
My intention is to simply add an input method that by my understanding is common while also removing a bug. It is not to take away any interactivity or functionality
For Example, with the PR #637 I can run:
dmenu -l 10 < ~./to_play_list | ani-cli
to easily connect dmenu to the script
chosen=$(dmenu -l 10 < ~./to_play_list); ani-cli "$chosen"
curl 'http://anime.example/get/most/popular' | sed -n 4p | ani-cli
to have ani-cli query the 4th most popular anime
popular=$(curl 'http://anime.example/get/most/popular' | sed -n 4p); ani-cli "$popular"
ani-cli -c "something"
in a script without worrying that a bug that redirects something will break the script or change its behavoiurI do see the value in that
Can you clarify what bug this would fix?
The bug is that if something gets piped in, the script prints > Invalid choice entered
infinitely
An idea as to how the piped input can be useful for you is in running test cases.
This is easy to do as each read
command takes only a single line from what is piped in.
An environment variable can be used to enable such a mode and only the following changes need to be made to the code:
This would indeed be a very useful thing and could enable semi-automated testing
Currently, piped input causes the script to break.
The following code can consume this input
The question after is what to do with it