Runs bash scripts using 'sh' and returns stdout.
sh
.sh
.bash
.txt
.txt
Setting | Description | Default |
---|---|---|
add-new-files | Boolean or list of extensions/patterns to match. | False |
added-in-version | Dexy version when this filter was first available. | |
additional-doc-filters | Filters to apply to additional documents created as side effects. | {} |
additional-doc-settings | Settings to apply to additional documents created as side effects. | {} |
args | Arguments to be passed to the executable. | |
check-return-code | Whether to look for nonzero return code. | True |
clargs | Arguments to be passed to the executable (same as 'args'). | |
command-string | The full command string. | %(prog)s %(args)s "%(script_file)s" %(scriptargs)s |
data-type | Alias of custom data class to use to store filter output. | generic |
env | Dictionary of key-value pairs to be added to environment for runs. | {} |
examples | Templates which should be used as examples for this filter. | ['bash'] |
exclude-add-new-files | List of patterns to skip even if they match add-new-files. | [] |
exclude-new-files-from-dir | List of directories to skip when adding new files. | [] |
executable | The executable to be run | sh -e |
ext | File extension to output. | None |
extension-map | Dictionary mapping input extensions to default output extensions. | None |
help | Help string for filter, if not already specified as a class docstring. | Runs bash scripts using 'sh' and returns stdout. |
initial-timeout | 10 | |
input-extensions | List of extensions which this filter can accept as input. | ['.sh', '.bash', '.txt', ''] |
install-dir | /usr/local/lib/python3.8/site-packages/dexy/filters | |
keep-originals | Whether, if additional-doc-filters are specified, the original unmodified docs should also be added. | False |
make-dummy-output | Whether to make a dummy output file when one is not generated and add-new-files is True. | False |
mkdir | A directory which should be created in working dir. | None |
mkdirs | A list of directories which should be created in working dir. | [] |
nodoc | Whether filter should be excluded from documentation. | False |
output | Whether to output results of this filter by default by reporters such as 'output' or 'website'. | False |
output-extensions | List of extensions which this filter can produce as output. | ['.txt'] |
override-workspace-exclude-filters | If True, document will be populated to other workspaces ignoring workspace-exclude-filters. | False |
path-extensions | strings to extend path with | [] |
preserve-prior-data-class | Whether output data class should be set to match the input data class. | False |
record-vars | Whether to add code that will automatically record values of variables. | False |
require-output | Should dexy raise an exception if no output is produced by this filter? | False |
scriptargs | Arguments to be passed to the executable. | |
tags | Tags which describe the filter. | ['shell', 'code'] |
timeout | 10 | |
use-wd | Whether to use a custom working directory when running filter. | True |
variables | A dictionary of variable names and values to make available to this filter. | {} |
vars | A dictionary of variable names and values to make available to this filter. | {} |
version-command | Command to call to return version of installed software. | None |
windows-version-command | Command to call on windows to return version of installed software. | None |
workspace-exclude-filters | Filters whose output should be excluded from workspace. | ['pyg'] |
workspace-includes | If set to a list of filenames or extensions, only these will be populated to working dir. | None |
write-stderr-to-stdout | Should stderr be piped to stdout? | False |
Here is a simple bash script:
date pwd
The bash filter runs scripts in bash and returns the output:
- script.sh|bash
Here is the output:
Tue Mar 31 22:12:05 UTC 2020 /tmp/tmpsy7_f1mj/ex/.dexy/work/5d/5d7f6184425b51e032b248a69670d4a6-001-bash
The sh filter runs scripts in sh (dash) and returns the output:
- script.sh|sh
Here is the output:
Tue Mar 31 22:12:05 UTC 2020 /tmp/tmpsy7_f1mj/ex/.dexy/work/84/84e70db12a901882c0b8c139b4020e77-001-sh
The shint filter runs scripts in a bash REPL, so you can see both input and output:
- script.sh|shint
Here is the output:
$ date Tue Mar 31 22:12:06 UTC 2020 $ pwd /tmp/tmpsy7_f1mj/ex/.dexy/work/c8/c80482b06f72edd1306125cb2376152b-001-shint
Normally, bash scripts run in a temporary working directory created and populated especially for the filter being run, but if you want to run a bash script which operates on your actual project directory, you can use the use-wd setting like this (this works on any of the bash-related filters):
- whereami.sh|shint: - shint: { 'use-wd' : False } $ pwd /tmp/tmpsy7_f1mj/ex
The default behavior of running in a working directory is intended to allow you to work with dependencies which have already been processed by dexy, and it also is intended to protect your working directory from side effects of running your bash script.
Content © 2020 Dr. Ana Nelson | Site Design © Copyright 2011 Andre Gagnon | All Rights Reserved.