All Projects → MGessinger → trident

MGessinger / trident

Licence: GPL-3.0 License
Trident provides an easy way to pass the output of one command to any number of targets.

Programming Languages

c
50402 projects - #5 most used programming language
Yacc
648 projects
Lex
420 projects
CMake
9771 projects

Projects that are alternatives of or similar to trident

effpi
Verified message-passing programs in Dotty
Stars: ✭ 42 (+16.67%)
Mutual labels:  processes
annotate-pull-request-from-checkstyle
cs2pr - Annotate a GitHub Pull Request based on a Checkstyle XML-report within your GitHub Action
Stars: ✭ 146 (+305.56%)
Mutual labels:  pipe
contact
This is a command line application for contact management with pipes in mind using a file based storage.
Stars: ✭ 27 (-25%)
Mutual labels:  pipe
RunProcess
Replacement for System.Diagnostics.Process
Stars: ✭ 15 (-58.33%)
Mutual labels:  processes
files-io
Read many files with node
Stars: ✭ 19 (-47.22%)
Mutual labels:  pipe
pipe-trait
Make it possible to chain regular functions
Stars: ✭ 22 (-38.89%)
Mutual labels:  pipe
async-container
Scalable multi-thread multi-process containers for Ruby.
Stars: ✭ 58 (+61.11%)
Mutual labels:  processes
ntee
Portable Unix shell command 'tee', with some extras - read from standard input and write to standard output and files
Stars: ✭ 22 (-38.89%)
Mutual labels:  pipe
ModernOperatingSystems AndrewTanenbaum
My notes after reading 'Modern Operating Systems' book by Andrew Tanenbaum and Herbert Bos.
Stars: ✭ 71 (+97.22%)
Mutual labels:  processes
observable ish
Observable state and events for browser and Flutter.
Stars: ✭ 26 (-27.78%)
Mutual labels:  pipe
NeuralFish
Neuroevolution in F#
Stars: ✭ 28 (-22.22%)
Mutual labels:  processes
pypely
Make your data processing easy
Stars: ✭ 17 (-52.78%)
Mutual labels:  pipe
pipe here
An Elixir macro for easily piping arguments at any position.
Stars: ✭ 33 (-8.33%)
Mutual labels:  pipe
libproc-rs
A rust library for getting information about running processes for Mac and Linux
Stars: ✭ 33 (-8.33%)
Mutual labels:  processes
prox
A Scala library for working with system processes
Stars: ✭ 93 (+158.33%)
Mutual labels:  pipe
px
ps and top for human beings
Stars: ✭ 151 (+319.44%)
Mutual labels:  pipe
ncolony
A colony of interacting processes
Stars: ✭ 23 (-36.11%)
Mutual labels:  processes
composition-logger
The most optimal way to visualize/debug functional compositions 🔍
Stars: ✭ 15 (-58.33%)
Mutual labels:  pipe
windows-process-monitor
A demo solution to illustrate approaches on getting information about processes and block/allow their start
Stars: ✭ 89 (+147.22%)
Mutual labels:  processes
pv
Unix Pipe Viewer (pv) utility in Node.js
Stars: ✭ 20 (-44.44%)
Mutual labels:  pipe

Trident: The multiple-pipe system

Trident provides an easy way to pipe the output of one command to not just one but many targets. These targets can be other commands, or files, and it can be filtered (line-wise) through a regular expression.

Introduction

A trident file is split into Jobs, which consist of

  • A job name. A valid job name starts with either a letter or an underscore, followed by zero or more letters, digits or underscores. That means, job0 is a valid name, but 0job is not.
  • A command. This is any program, along with any number of arguments. Arguments which contain any of the reserved words JOB, CMD, OUT or FILE must be set in quotation marks (either single or double quotes are allowed).
  • One or more targets. A target can either be a file, or another job. A target can also contain a regular expression, in which case the output of this job will be filtered through this RegEx, and only those lines which match are passed to the actual target.

Syntax

To define a new job, use the keyword JOB followed by the job name. Then, the keyword CMD is followed by the program and its arguments. Finally, the keyword OUT indicates the start of the list of targets. A target consists of an optional RegEx (enclosed in /re/), either the keyword FILE and the name of a file (absolute or relative path), or JOB followed by the job name. The special file names stdout and stderr are reserved for their standard usage.

To invert a regular expression (and thus output every line not matching it), precede it by an exclamation mark: ! /re/.

Examples

This example file in essence recreates the functionality of grep:

JOB repeat
CMD cat
OUT
	- /regular exression/ FILE stdout

A sightly more sophisticated example might read URLs and store the associated IPs in a file.

JOB repeat
CMD cat
OUT
	- /^\([0-9]\{1,3\}.\)\{3\}[0-9]\{1,3\}$/ FILE ips.dat
	- /\w/ JOB query_dns

JOB query_dns
CMD dig +short a -f -
OUT
	- FILE queried_ips.dat

In this example, the main job reads data from stdin, and all lines that match a (very crude) match for an IP are written directly to a file. Those lines that contain at least one word character are queried from a DNS first, and then written to a different file. Note that no two jobs can access the same file at the same time (except for stdout and stderr).

Command line interface

Trident takes as command line arguments the paths to the input files, which are read in the order that they appear in. All files are considered as one continuous stream of input.

After parsing all input files, by default trident executes the first job defined in the input. This behaviour can be overwritten by using the command line option -s to explicitly provide a job name:

./trident example.tr -s latex

Compilation

Trident uses Flex and Bison/Yacc for parsing input, so both of those need to be installed.

This repository uses CMake as its build system, so to compile trident simply run

mkdir build
cd build
cmake ..
make -j

After finishing the compilation, an executable file called trident will be created in the directory build. If you want to install the program system-wide, additionally run

sudo make install
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].