file-command-qq-0.1.0.3: Quasiquoter for system commands involving filepaths

Safe HaskellNone
LanguageHaskell2010

FileCommand

Synopsis

Documentation

s :: QuasiQuoter Source

A simple quasiquoter for executing system commands on a filepath for example

> [s|echo $filename|] "/home/test/thing.txt"

will return

  thing.txt
  ExitSuccess
 

You can think of [s|echo $filename|] essentially converts into

   \path -> system $ "echo" ++ encodeString (filename path)
 

Here is another example

> [s|gcc $path -o $directory$basename.o|] "/home/test/thing.c"

All "file parts" start with a '$'. The '$' can be escaped by preceding it with a '\'

There are the following options for "file parts"

  • $path
  • $root
  • $directory
  • $parent
  • $filename
  • $dirname
  • $basename
  • $ext