diff options
author | Laura <the-ceo-of-antifa@protonmail.com> | 2023-01-16 19:03:20 +0100 |
---|---|---|
committer | Laura <the-ceo-of-antifa@protonmail.com> | 2023-01-16 19:03:20 +0100 |
commit | 4657b2251d0a57e1059183807738d19b85ea9ea9 (patch) | |
tree | bba6bded3556301b40d19bfb246fb2db1176e2a5 | |
parent | 028a7662ca1c8f51859fbf9f7c54f80c290eff58 (diff) | |
download | miaowe-4657b2251d0a57e1059183807738d19b85ea9ea9.tar.gz miaowe-4657b2251d0a57e1059183807738d19b85ea9ea9.zip |
List command with associated dir structure change.
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | miaowe.hs | 4 | ||||
-rwxr-xr-x | nya.sh | 3 |
3 files changed, 11 insertions, 4 deletions
@@ -10,7 +10,11 @@ To build: The resulting executable will be called "miaowe". -Miaowe includes no networking code of its own, but assumes stdin and stdout will be connected to an IRC server. A zsh script, nya.sh, is included to help with this. Users of other shells may need to adjust the script to work with their shell. NickServ login credentials are placed in a file called "conn", on the first line and separated by a space. Image files are read from the working directory. +Miaowe includes no networking code of its own, but assumes stdin and stdout will be connected to an IRC server. A zsh script, nya.sh, is included to help with this. Users of other shells may need to adjust the script to work with their shell. NickServ login credentials are placed in a file called "conn" (in the parent of miaowe's PWD), on the first line and separated by a space. Image files are read from the working directory. If nya.sh is used, image_directory becomes miaowe's PWD. + +Available commands: +* List -- lists all files in PWD +* Quit -- quits To run: @@ -18,4 +22,4 @@ To run: or: - ./nya.sh <channel> + ./nya.sh <channel> <image_directory> @@ -184,6 +184,8 @@ processCommand :: IrcChannel -> MircString -> IO () processCommand channel command | length (words command) < 5 = sendToChannel channel "You need to specify a command." | (words command)!!4 == "Quit" = exitSuccess + | (words command)!!4 == "List" = listDirectory "." + >>= sendToChannel channel . intercalate "\n" | otherwise = (if isInfixOf "/" ((words command)!!4) then sendToChannel channel @@ -201,7 +203,7 @@ mainLoop channel = waitForCommand main :: IO () main = - openFile "conf" ReadMode + openFile "../conf" ReadMode >>= (\handle -> hGetLine handle >>= putStr . ircConnect @@ -15,8 +15,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +binary=$( readlink -f miaowe ) # To debug, uncomment and move >&p to end of line. coproc nc irc.libera.chat 6667 # |tee /dev/stderr -./miaowe $1 <&p >&p # |tee /dev/stderr +(cd $2 && exec $binary $1) <&p >&p # |tee /dev/stderr pkill nc |