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

[ library, mit, system ] [ Propose Tags ] [ Report a vulnerability ]

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"

  • $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


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 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 && <4.8), parsec (>=3.1 && <3.2), process (>=1.2 && <1.3), system-filepath (>=0.4 && <0.5), template-haskell (>=2.9 && <2.10), text (>=1.1 && <1.2) [details]
License MIT
Author Jonathan Fischoff
Maintainer jonathangfischoff@gmail.com
Category System
Home page https://github.com/jfischoff/file-command-qq
Uploaded by JonathanFischoff at 2014-11-10T06:11:53Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 4366 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for file-command-qq-0.1.0.2

[back to package description]

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