summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-01-13 22:26:56 +0000
committerKarl Berry <karl@freefriends.org>2018-01-13 22:26:56 +0000
commit8321808ed1278e2b4fc5e6d58fcb1acecc4155c0 (patch)
tree3a919f39d8a823b139635052cb15b83bdbdfc8ef /Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl
parent4cc1370e31979d579fabb2561b6de643adde68d9 (diff)
latexindent (13jan18)
git-svn-id: svn://tug.org/texlive/trunk@46303 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl')
-rwxr-xr-xMaster/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl51
1 files changed, 51 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl b/Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl
new file mode 100755
index 00000000000..660b81d2399
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexindent/latexindent-module-installer.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/env perl
+# latexindent.pl, version 3.3, 2017-08-21
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# See http://www.gnu.org/licenses/.
+#
+# Chris Hughes, 2017
+#
+# For all communication, please visit: https://github.com/cmhughes/latexindent.pl
+
+use strict;
+use warnings;
+
+print ("============\nlatexindent.pl module installer\n============\n");
+print ("Would you like to run the following commands?\n");
+my @modulesToInstall = ("cpanm YAML::Tiny","cpanm File::HomeDir","cpanm Unicode::GCString","cpanm Log::Log4perl","cpanm Log::Dispatch");
+foreach (@modulesToInstall) {
+ print $_,"\n";
+}
+if (prompt_yn("Press Y to run the above commands")){
+ foreach (@modulesToInstall) {
+ system($_);
+ }
+} else {
+ print "Not installing modules\n";
+}
+exit;
+
+# reference: https://stackoverflow.com/questions/18103501/prompting-multiple-questions-to-user-yes-no-file-name-input
+sub prompt {
+ my ($query) = @_; # take a prompt string as argument
+ local $| = 1; # activate autoflush to immediately show the prompt
+ print $query;
+ chomp(my $answer = <STDIN>);
+ return $answer;
+}
+
+sub prompt_yn {
+ my ($query) = @_;
+ my $answer = prompt("$query (Y/N): ");
+ return lc($answer) eq 'y';
+}