diff options
author | Karl Berry <karl@freefriends.org> | 2024-10-31 20:34:15 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2024-10-31 20:34:15 +0000 |
commit | 1cdef87edb281bc04e8767e0657299011e3272eb (patch) | |
tree | c6db9e5df869db86923c7665c49031755e3f1327 /Master/texmf-dist/scripts | |
parent | a4915c2bd0ce3b4301f222854a5b5d81beba9b53 (diff) |
eolang (31oct24)
git-svn-id: svn://tug.org/texlive/trunk@72724 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts')
-rwxr-xr-x | Master/texmf-dist/scripts/eolang/eolang.pl | 48 |
1 files changed, 6 insertions, 42 deletions
diff --git a/Master/texmf-dist/scripts/eolang/eolang.pl b/Master/texmf-dist/scripts/eolang/eolang.pl index 48ba53dc5b8..6018cd52515 100755 --- a/Master/texmf-dist/scripts/eolang/eolang.pl +++ b/Master/texmf-dist/scripts/eolang/eolang.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl # (The MIT License) # -# Copyright (c) 2022-2024 Yegor Bugayenko +# Copyright (c) 2021-2024 Yegor Bugayenko # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the 'Software'), to deal @@ -21,58 +21,22 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -# 2024-02-14 0.18.1 +# 0000-00-00 0.18.2 package eolang; use warnings; use strict; +use lib('.'); +use tools; use File::Basename; # Hash of incoming command line arguments. my %args = map { $_ => 1 } @ARGV; -# Read file content. -sub readfile { - my ($path) = @_; - open(my $h, '<', $path) or die('Cannot open file: ' . $path); - my $content; { local $/; $content = <$h>; } - return $content; -} - -# Save content to file. -sub savefile { - my ($path, $content) = @_; - open(my $f, '>', $path) or error('Cannot open file for writing: ' . $path); - print $f $content; - close($f); - my $size = -s $path; - info("File saved to '$path' ($size bytes)"); -} - -# Print INFO message to the console. -sub info { - my ($txt) = @_; - print $txt . "\n"; -} - -# Print DEBUG message to the console. -sub debug { - my ($txt) = @_; - if (exists $args{'--verbose'}) { - print $txt . "\n"; - } -} - -# Print ERROR message to the console. -sub error { - my ($txt) = @_; - print STDERR $txt . "\n"; -} - if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { info("This script helps embedding \\phiquation and \\phiq into .tex document\n\n" . "Usage:\n" . - " eolang [<options>] <.tex file path>\n\n" . + " eolang [<options>] <.tex input file path> <.tex output file path>\n\n" . "Options:\n" . " -v, --version Print the current version of the tool and exit\n" . " -?, --help Print this help screen\n" . @@ -80,7 +44,7 @@ if (@ARGV+0 eq 0 or exists $args{'--help'} or exists $args{'-?'}) { " --tmpdir=path Temp directory with .tex files ('_eolang' by default)\n\n" . "If any issues, report to GitHub: https://github.com/yegor256/bibcop"); } elsif (exists $args{'--version'} or exists $args{'-v'}) { - info('0.18.1 2024-02-14'); + info('0.18.2 0000-00-00'); } else { my ($src, $target) = grep { not($_ =~ /^-.*$/) } @ARGV; if (not $src) { |