From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

#!perl
# Note: This script is a CLI for Riap function /App/column/run/column_run
# and generated automatically using Perinci::CmdLine::Gen version 0.499
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2021-07-08'; # DATE
our $DIST = 'App-column-run'; # DIST
our $VERSION = '0.005'; # VERSION
use 5.010001;
use strict;
my $cmdline = Perinci::CmdLine::Any->new(
url => "/App/column/run/column_run",
program_name => "column-run",
log => 1,
read_config => 0,
read_env => 0,
);
$cmdline->run;
# ABSTRACT: Run several commands and show their output in multiple columns
# PODNAME: column-run
__END__
=pod
=encoding UTF-8
=head1 NAME
column-run - Run several commands and show their output in multiple columns
=head1 VERSION
This document describes version 0.005 of column-run (from Perl distribution App-column-run), released on 2021-07-08.
=head1 SYNOPSIS
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'
=head1 DESCRIPTION
This utility is similar to using the Unix utility L<pr> to columnate output,
something like (in bash):
% pr -T -m -w $COLUMNS <(command1 args...) <(command2 args...)
except with the following differences:
=over
=item * commands are run in sequence, not in parallel (although parallel execution is
a TODO list item);
=item * all output are collected first, then displayed (although streaming output is a
TODO list item);
=item * multiplexing STDIN to all commands;
=item * ANSI color and wide character handling;
=item * passing adjusted COLUMNS environment to commands so they can adjust output;
=item * passing common arguments and environment variables to all commands (as well as
allowing each command to have its unique arguments or environment variables).
=back
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--args-arrays-json>=I<s>
Arguments to give to each command (an array of arrays of strings) (JSON-encoded).
See C<--args-arrays>.
=item B<--args-arrays>=I<s>
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.
=item B<--command>=I<s@>*
Can also be specified as the 1st command-line argument and onwards.
Can be specified multiple times.
=item B<--commands-json>=I<s>
See C<--command>.
Can also be specified as the 1st command-line argument and onwards.
=item B<--common-arg>=I<s@>
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.
Can be specified multiple times.
=item B<--common-args-json>=I<s>
Common arguments to pass to each command (JSON-encoded).
See C<--common-arg>.
=item B<--common-env>=I<s>%
Common environment variables to pass to each command.
Each value is a name-value pair, use I<key=value> syntax. Can be specified multiple times.
=item B<--common-envs-json>=I<s>
Common environment variables to pass to each command (JSON-encoded).
See C<--common-env>.
=item B<--envs-arrays-json>=I<s>
Environment variables to give to each command (an array of hashes of strings) (JSON-encoded).
See C<--envs-arrays>.
=item B<--envs-arrays>=I<s>
Environment variables to give to each command (an array of hashes of strings).
=item B<--linum-width>=I<s>
Line number width.
=item B<--on-long-line>=I<s>
What to do to long lines.
Default value:
"clip"
Valid values:
["clip","wrap"]
=item B<--separator>=I<s>
Separator character between columns.
Default value:
"|"
=item B<--show-linum>
Show line number.
=item B<--wrap>
Shortcut for --on-long-line=wrap.
See C<--on-long-line>.
=back
=head2 Logging options
=over
=item B<--debug>
Shortcut for --log-level=debug.
=item B<--log-level>=I<s>
Set log level.
=item B<--quiet>
Shortcut for --log-level=error.
=item B<--trace>
Shortcut for --log-level=trace.
=item B<--verbose>
Shortcut for --log-level=info.
=back
=head2 Output options
=over
=item B<--page-result>
Filter output through a pager.
=item B<--view-result>
View output using a viewer.
=back
=head2 Other options
=over
=item B<--help>, B<-h>, B<-?>
Display help message and exit.
=item B<--version>, B<-v>
Display program's version and exit.
=back
=head1 COMPLETION
This script has shell tab completion capability with support for several
shells.
=head2 bash
To activate bash completion for this script, put:
complete -C column-run column-run
in your bash startup (e.g. F<~/.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 L<cpanm-shcompgen>
which can activate shell completion for scripts immediately.
=head2 tcsh
To activate tcsh completion for this script, put:
complete column-run 'p/*/`column-run`/'
in your tcsh startup (e.g. F<~/.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 L<shcompgen> (see above).
=head2 other shells
For fish and zsh, install L<shcompgen> as described above.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/App-column-run>.
=head1 SOURCE
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website L<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.
=head1 SEE ALSO
L<pr>. Unix utility to format and columnate text.
L<column>. Unix utility to fill columns with list.
L<diff>. The --side-by-side (-y) option display files in two columns.
=head1 AUTHOR
perlancar <perlancar@cpan.org>
=head1 COPYRIGHT AND LICENSE
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.
=cut