The file-command-qq package

[Tags:library, mit]

file-command-qq is a simple quasiquoter for running system commands that take a filepath as an argument.

For instance

> :set -XOverloadedStrings
> import FileCommand
> import Filesystem.Path
> [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"

Which correspond to the respective functions in https://hackage.haskell.org/package/system-filepath-0.4.6/docs/Filesystem-Path.html#g:1


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.0.5
Dependencies base (==4.7.*), parsec (==3.1.*), process (==1.2.*), system-filepath (==0.4.*), template-haskell (==2.9.*), text (>=1.1 && <1.3) [details]
License MIT
Author Jonathan Fischoff
Maintainer jonathangfischoff@gmail.com
Category System
Home page https://github.com/jfischoff/file-command-qq
Uploaded Sun Feb 1 19:27:17 UTC 2015 by JonathanFischoff
Distributions NixOS:0.1.0.5
Downloads 955 total (16 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2015-02-01 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for file-command-qq

Readme for file-command-qq-0.1.0.5

file-command-qq is a simple quasiquoter for running system commands that take a filepath as an argument.

For instance

> :set -XOverloadedStrings
> import FileCommand
> import Filesystem.Path
> [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)

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

Which correspond to the respective functions in https://hackage.haskell.org/package/system-filepath-0.4.6/docs/Filesystem-Path.html#g:1