diff options
Diffstat (limited to 'src/property/command.lisp')
-rw-r--r-- | src/property/command.lisp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/property/command.lisp b/src/property/command.lisp new file mode 100644 index 0000000..a040968 --- /dev/null +++ b/src/property/command.lisp @@ -0,0 +1,15 @@ +(in-package :consfigurator.property.command) + +(defprop shell-command :posix (cmd args &key environment) + "A property which can be applied by running a shell command. + +Keyword argument :environment is a plist of environment variables to be set +when running the command, using env(1)." + (:apply (when environment + (let ((env (cons "env" + (loop for (var . val) in environment + collect (concat (symbol-name var) + "=" + val))))) + (setq args (nconc env args)))) + (connection-run (apply #'shellcmd cmd args)))) |