New Upstream Snapshot - cleo
Ready changes
Summary
Merged new upstream version: 0.004+git20180827.1.3e22cae (was: 0.004).
Resulting package
Built on 2023-01-19T09:09 (took 3m26s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-snapshots cleo
Lintian Result
Diff
diff --git a/Changes b/Changes
index af0fc2e..a812f26 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,9 @@
+0.005 2016-07-28 09:15:48 America/Los_Angeles
+
+ - Now supports multi-line commands.
+ - Use ... to show and run a command immediately.
+ - Use the 'c' command to run all remaining commands.
+
0.004 2014-03-23 09:15:48 America/Los_Angeles
- Fixed off-by-one error
diff --git a/META.json b/META.json
index 8c26a06..e9d096b 100644
--- a/META.json
+++ b/META.json
@@ -4,13 +4,13 @@
"unknown"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380",
+ "generated_by" : "ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "App-Cleo",
"no_index" : {
@@ -48,5 +48,6 @@
"web" : "https://github.com/thaljef/App-Cleo"
}
},
- "version" : "0.004"
+ "version" : 0.004,
+ "x_serialization_backend" : "JSON::PP version 4.07"
}
diff --git a/META.yml b/META.yml
index 94635e3..43847c8 100644
--- a/META.yml
+++ b/META.yml
@@ -3,27 +3,28 @@ abstract: unknown
author:
- unknown
build_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '0'
configure_requires:
- ExtUtils::MakeMaker: 0
+ ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.86, CPAN::Meta::Converter version 2.133380'
+generated_by: 'ExtUtils::MakeMaker version 7.64, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: App-Cleo
no_index:
directory:
- t
- inc
requires:
- File::Slurp: 0
- Term::ANSIColor: 0
- Term::ReadKey: 0
- Time::HiRes: 0
- strict: 0
- warnings: 0
+ File::Slurp: '0'
+ Term::ANSIColor: '0'
+ Term::ReadKey: '0'
+ Time::HiRes: '0'
+ strict: '0'
+ warnings: '0'
resources:
repository: https://github.com/thaljef/App-Cleo
version: 0.004
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff --git a/README.md b/README.md
index e2172de..72fe0b2 100644
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@ But I couldn't figure it out, so I built this. Your mileage may vary.
# PLAYBACK
-`cleo` always pauses and waits for a keypress before displaying a command and
-before executing it. Pressing any key besides those listed below will advance
+`cleo` pauses and waits for a keypress before displaying a command and
+before executing it. Pressing any key besides those listed below will advance
the playback:
Key Action
@@ -26,6 +26,7 @@ the playback:
s skip the current command
r redo the current command
p redo the previous command
+ c run all remaining commands
q quit playback
# COMMANDS
@@ -41,9 +42,13 @@ You can also add a few special tokens that `cleo` recognizes:
will be executed immediately. This is useful for running setup commands at the
beginning of your demonstration.
+- `...`
+
+ Commands starting with `...` (three periods) will be executed without waiting for a keypress. This is useful if you want to show a series of commands but don't need to stop and explain each one as you go.
+
- `%%%`
- Within a command, `%%%` (three percent signs) will cause `cleo` to pause and
+ Within a command, `%%%` (three percent signs) will cause playback to pause and
wait for a keypress before displaying the rest of the command. This is useful
if you want to stop in the middle of a command to give some explanation.
@@ -73,7 +78,6 @@ Cygwin. Personally, I have only used `cleo` on Mac OS X.
- Jump to arbitrary command number
- Support backspacing in recorded command
-- Support multi-line recorded commands
- Write unit tests
# AUTHOR
diff --git a/bin/cleo b/bin/cleo
index 9b93118..b6b8933 100644
--- a/bin/cleo
+++ b/bin/cleo
@@ -36,8 +36,8 @@ But I couldn't figure it out, so I built this. Your mileage may vary.
=head1 PLAYBACK
-C<cleo> always pauses and waits for a keypress before displaying a command and
-before executing it. Pressing any key besides those listed below will advance
+C<cleo> pauses and waits for a keypress before displaying a command and
+before executing it. Pressing any key besides those listed below will advance
the playback:
Key Action
@@ -45,7 +45,9 @@ the playback:
s skip the current command
r redo the current command
p redo the previous command
+ c run all remaining commands
q quit playback
+ [number][not a digit] jump to specific command number
=head1 COMMANDS
@@ -62,9 +64,13 @@ Commands starting with C<!!!> (three exclamation points) are not displayed and
will be executed immediately. This is useful for running setup commands at the
beginning of your demonstration.
+=item C<...>
+
+Commands starting with C<...> (three periods) will be executed without waiting for a keypress. This is useful if you want to show a series of commands but don't need to stop and explain each one as you go.
+
=item C<%%%>
-Within a command, C<%%%> (three percent signs) will cause C<cleo> to pause and
+Within a command, C<%%%> (three percent signs) will cause playback to pause and
wait for a keypress before displaying the rest of the command. This is useful
if you want to stop in the middle of a command to give some explanation.
@@ -96,12 +102,8 @@ Cygwin. Personally, I have only used C<cleo> on Mac OS X.
=over 4
-=item Jump to arbitrary command number
-
=item Support backspacing in recorded command
-=item Support multi-line recorded commands
-
=item Write unit tests
=back
diff --git a/debian/changelog b/debian/changelog
index e2fef5c..76084bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+cleo (0.004+git20180827.1.3e22cae-1) UNRELEASED; urgency=low
+
+ * New upstream snapshot.
+
+ -- Debian Janitor <janitor@jelmer.uk> Thu, 19 Jan 2023 09:06:24 -0000
+
cleo (0.004-4) unstable; urgency=medium
[ Debian Janitor ]
diff --git a/lib/App/Cleo.pm b/lib/App/Cleo.pm
index c30904d..4e3c427 100644
--- a/lib/App/Cleo.pm
+++ b/lib/App/Cleo.pm
@@ -8,6 +8,8 @@ use Term::ANSIColor qw(colored);
use File::Slurp qw(read_file);
use Time::HiRes qw(usleep);
+use constant PS1 => 'ps1';
+use constant PS2 => 'ps2';
our $VERSION = 0.004;
#-----------------------------------------------------------------------------
@@ -17,8 +19,10 @@ sub new {
my $self = {
shell => $ENV{SHELL} || '/bin/bash',
- prompt => colored( ['green'], '(%d)$ '),
+ ps1 => colored( ['green'], '(%d)$ '),
+ ps2 => colored( ['green'], '> '),
delay => 25_000,
+ state => PS1,
@_,
};
@@ -41,43 +45,68 @@ sub run {
ReadMode('raw');
local $| = 1;
+ local $SIG{CHLD} = sub {
+ print "Child shell exited!\n";
+ ReadMode('restore');
+ exit;
+ };
+
chomp @commands;
@commands = grep { /^\s*[^\#;]\S+/ } @commands;
+ my $continue_to_end = 0;
+
CMD:
for (my $i = 0; $i < @commands; $i++) {
- my $cmd = $commands[$i];
+ my $cmd = defined $commands[$i] ? $commands[$i] : die "no command $i";
chomp $cmd;
+ my $keep_going = $cmd =~ s/^\.\.\.//;
+ my $run_in_background = $cmd =~ s/^!!!//;
+
$self->do_cmd($cmd) and next CMD
- if $cmd =~ s/^!!!//;
+ if $run_in_background;
- print sprintf $self->{prompt}, $i;
+ no warnings 'redundant';
+ my $prompt_state = $self->{state};
+ print sprintf $self->{$prompt_state}, $i;
my @steps = split /%%%/, $cmd;
while (my $step = shift @steps) {
- my $key = ReadKey(0);
- print "\n" if $key =~ m/[srp]/;
+ my $should_pause = !($keep_going || $continue_to_end);
+ my $key = $should_pause ? ReadKey(0) : '';
+ if ($key =~ /^\d$/) {
+ $key .= $1 while (ReadKey(0) =~ /^(\d)/);
+ }
+ print "\n" if $key =~ m/^[srp]|[0-9]+/;
- last CMD if $key eq 'q';
- next CMD if $key eq 's';
- redo CMD if $key eq 'r';
- $i--, redo CMD if $key eq 'p';
+ last CMD if $key eq 'q';
+ next CMD if $key eq 's';
+ redo CMD if $key eq 'r';
+ $i--, redo CMD if $key eq 'p';
+ $i = $key, redo CMD if $key =~ /^\d+$/;
+ $continue_to_end = 1 if $key eq 'c';
$step .= ' ' if not @steps;
my @chars = split '', $step;
print and usleep $self->{delay} for @chars;
}
- my $key = ReadKey(0);
+ my $should_pause = !($keep_going || $continue_to_end);
+ my $key = $should_pause ? ReadKey(0) : '';
+ if ($key =~ /^\d$/) {
+ $key .= $1 while (ReadKey(0) =~ /^(\d)/);
+ }
print "\n";
- last CMD if $key eq 'q';
- next CMD if $key eq 's';
- redo CMD if $key eq 'r';
- $i--, redo CMD if $key eq 'p';
+ last CMD if $key eq 'q';
+ next CMD if $key eq 's';
+ redo CMD if $key eq 'r';
+ $i--, redo CMD if $key eq 'p';
+ $i = $key, redo CMD if $key =~ /^\d+$/;
+ $continue_to_end = 1 if $key eq 'c';
$self->do_cmd($cmd);
}
@@ -100,6 +129,10 @@ sub do_cmd {
my $fh = $self->{fh};
print $fh "$cmd\n";
+
+ ($self->{state} = PS2) and return 1
+ if $cmd =~ m{\s+\\$};
+
print $fh "kill -14 $$\n";
$fh->flush;
@@ -107,6 +140,8 @@ sub do_cmd {
until ($cmd_is_finished) {}
$cmd_is_finished = 0;
+ $self->{state} = PS1;
+
return 1;
}
@@ -139,14 +174,20 @@ supported:
=item delay
-Number of milliseconds to wait before displaying each character of the command.
+Number of microseconds to wait before displaying each character of the command.
The default is C<25_000>.
-=item prompt
+=item ps1
String to use for the artificial prompt. The token C<%d> will be substituted
with the number of the current command. The default is C<(%d)$>.
+=item ps2
+
+String to use for the artificial prompt that appears for multiline commands. The
+token C<%d> will be substituted with the number of the current command. The
+default is C<< > >>.
+
=item shell
Path to the shell command that will be used to run the commands. Defaults to
Debdiff
File lists identical (after any substitutions)
No differences were encountered in the control files