Paralix CLI is a command line interface tool written in Golang. The purpose of this CLI is to provide a faster and better way to execute bash commands in parallel.
Currently, the CLI has one command called command
. This command allows you to execute a bash command with placeholders in parallel.
Here are the flags available for the command
command:
-
--execute
,-e
: A string flag that takes the command to execute with placeholders. The placeholders are denoted by<KEY>
and will be replaced with values provided either by the-p
flag or an input file.
Example:--execute 'echo <WHAT_SHOULD_ECHO>'
. -
--placeholder
,-p
: A string flag that takes placeholders in the format ofKEY={VALUE1,VALUE2,VALUE3}
. Multiple placeholders can be separated by a comma. These values will replace the placeholders in the command provided by the-e
flag. Example:-p 'WHAT_SHOULD_ECHO={HELLO,WORLD}'
. -
--inputfile
,-f
: A string flag that takes a file path that contains the inputs to run. Each input should be on a new line. These inputs will replace the placeholders in the command provided by the-e
flag.
Example:-f 'WHAT_SHOULD_ECHO'
. -
--output
,-o
: A string flag that takes a file path to write the output of the command.
The output will be written in the following format:
PlaceholderA
Output of command with PlaceholderA
PlaceholderB
Output of command with PlaceholderB
PlaceholerN Output of command with PlaceholderN
Here are some examples of how to use the Paralix CLI:
Execute a command with placeholders and values provided by an input file.
$ paralix command --execute 'aws s3 ls s3://<BUCKET_NAME> --inputfile BUCKET_NAME -o upgrade_output
Assuming the BUCKET_NAME
file contains the following:
myfiles1
myfiles2
This will execute the command aws s3 ls s3://<BUCKET_NAME>
twice, once with myfiles1
and once with myfiles2
.
- The output file will looks like:
bucket1
file1
file2
file3
bucket2
file4
file5
file6
Execute a command with placeholders and write the output to a file.
$paralix command --execute 'curl https://some.api/endpoint/to/send/with/<NAME>' --inputfile 'NAME' --output 'curl_output.txt'
-
Assuming the NAME file contains:
nameA
nameB -
The output file will looks like:
NameA
curl output for NameA
NameB
curl output for NameB
To use Paralix CLI, you need to have Go installed on your system. If you don't have Go installed, you can download it from the official Go website.
Once you have Go installed, you can install Paralix CLI using the following command:
go get github.com/tamirdavid/paralix
If you would like to contribute to the Paralix CLI, please open a pull request on the GitHub repository.