column-run - Run several commands and show their output in multiple columns
This document describes version 0.005 of column-run (from Perl distribution App-column-run), released on 2021-07-08.
Usage:
% column-run [--args-arrays-json=s] [--args-arrays=s] [--command=s+] [--commands-json=s] [--common-arg=s+] [--common-args-json=s] [--common-env key=s] [--common-envs-json=s] [--debug] [--envs-arrays-json=s] [--envs-arrays=s] [--linum-width=s] [--log-level=level] [--no-show-linum] [--noshow-linum] [--on-long-line=s] [--page-result[=program]] [--quiet] [--separator=s] [--show-linum] [--trace] [--verbose] [--view-result[=program]] [--wrap] -- <command> ...
Examples:
Compare JSON vs Perl Data::Dump vs YAML dump, side by side:
% cat ~/samples/bookstore.json | COLOR=1 column-run pp-json json2dd json2yaml
Compare different color themes:
% cat ~/samples/bookstore.json | COLOR=1 column-run --envs-arrays-json '[{"DATA_DUMP_COLOR_THEME":"Default256"},{"DATA_DUMP_COLOR_THEME":"Default16"}]' 'json2dd --dumper=Data::Dump::Color' 'json2dd --dumper=Data::Dump::Color'
This utility is similar to using the Unix utility pr to columnate output, something like (in bash):
% pr -T -m -w $COLUMNS <(command1 args...) <(command2 args...)
except with the following differences:
commands are run in sequence, not in parallel (although parallel execution is a TODO list item);
all output are collected first, then displayed (although streaming output is a TODO list item);
multiplexing STDIN to all commands;
ANSI color and wide character handling;
passing adjusted COLUMNS environment to commands so they can adjust output;
passing common arguments and environment variables to all commands (as well as allowing each command to have its unique arguments or environment variables).
* marks required options.
*
Arguments to give to each command (an array of arrays of strings) (JSON-encoded).
See --args-arrays.
--args-arrays
Arguments to give to each command (an array of arrays of strings).
If `--common-args` is also set, then the common arguments will be added first, then the per-command arguments.
Can also be specified as the 1st command-line argument and onwards.
Can be specified multiple times.
See --command.
--command
Common arguments to pass to each command.
If `--args-arrays` is also set, then the common arguments will be added first, then the per-command arguments.
Common arguments to pass to each command (JSON-encoded).
See --common-arg.
--common-arg
Common environment variables to pass to each command.
Each value is a name-value pair, use key=value syntax. Can be specified multiple times.
Common environment variables to pass to each command (JSON-encoded).
See --common-env.
--common-env
Environment variables to give to each command (an array of hashes of strings) (JSON-encoded).
See --envs-arrays.
--envs-arrays
Environment variables to give to each command (an array of hashes of strings).
Line number width.
What to do to long lines.
Default value:
"clip"
Valid values:
["clip","wrap"]
Separator character between columns.
"|"
Show line number.
Shortcut for --on-long-line=wrap.
See --on-long-line.
--on-long-line
Shortcut for --log-level=debug.
Set log level.
Shortcut for --log-level=error.
Shortcut for --log-level=trace.
Shortcut for --log-level=info.
Filter output through a pager.
View output using a viewer.
Display help message and exit.
Display program's version and exit.
This script has shell tab completion capability with support for several shells.
To activate bash completion for this script, put:
complete -C column-run column-run
in your bash startup (e.g. ~/.bashrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is recommended, however, that you install modules using cpanm-shcompgen which can activate shell completion for scripts immediately.
To activate tcsh completion for this script, put:
complete column-run 'p/*/`column-run`/'
in your tcsh startup (e.g. ~/.tcshrc). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately.
It is also recommended to install shcompgen (see above).
For fish and zsh, install shcompgen as described above.
Please visit the project's homepage at https://metacpan.org/release/App-column-run.
Source repository is at https://github.com/perlancar/perl-App-column-run.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-column-run
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
pr. Unix utility to format and columnate text.
column. Unix utility to fill columns with list.
diff. The --side-by-side (-y) option display files in two columns.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2021, 2020 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::column::run, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::column::run
CPAN shell
perl -MCPAN -e shell install App::column::run
For more information on module installation, please visit the detailed CPAN module installation guide.