Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expand: read stdin #324

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions bin/expand
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ EOF
exit $_[0];
}

usage(1) unless scalar @ARGV > 0;
usage(0) if grep /^-h$/, @ARGV;

# at most one argument
Expand Down Expand Up @@ -114,6 +113,9 @@ for my $file (@files) {
close IN;

}
unless (@files) {
do_expand <STDIN>;
}

__END__

Expand All @@ -125,9 +127,6 @@ expand - convert tabs to spaces

expand [B<-h>] [B<-tabstop>] [B<-tab1, tab2, ...>] [B<file> ...]

unexpand [B<-h>] [B<-a>] [B<-tabstop>] [B<-tab1, tab2, ...>]
[B<file> ...]

=head1 DESCRIPTION

I<expand> processes the named files or the standard input writing the
Expand All @@ -140,10 +139,7 @@ If a single B<tabstop> argument is given, tabs are set B<tabstop> spaces
apart instead of the default 8. If multiple tabstops are given then
the tabs are set at those specific columns.

I<unexpand> puts tabs back into the data from the standard input or the
named files and writes the result on the standard output.

Option (with I<expand> and I<unexpand>):
=head1 OPTIONS

=over 4

Expand All @@ -153,19 +149,6 @@ Print a usage message and exit with a status code indicating success.

=back

Option (with I<unexpand> only):

=over 4

=item -a

By default, only leading blanks and tabs are reconverted to maximal
strings of tabs. If the B<-a> option is given, tabs are inserted
whenever they would compress the resultant file by replacing two or
more characters.

=back

=head1 AUTHOR

=for html
Expand Down