aboutsummaryrefslogtreecommitdiff
path: root/gmi.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gmi.pl')
-rwxr-xr-xgmi.pl23
1 files changed, 21 insertions, 2 deletions
diff --git a/gmi.pl b/gmi.pl
index f737609..a1f8656 100755
--- a/gmi.pl
+++ b/gmi.pl
@@ -26,7 +26,7 @@ use warnings;
use feature qw(refaliasing);
no warnings qw(experimental::refaliasing);
-our $VERSION = 'v1.0.2';
+our $VERSION = 'v1.0.3';
# Modules
use IO::Socket::SSL; # CPAN
@@ -190,6 +190,9 @@ my %commands = (
'bookmark-del' => [sub { bookmark_del($_[0]) }, 'Delete bookmark by number' .
' (use \'bookmarks\' to see numbers).'],
'bookmarks' => [sub { bookmarks(); }, 'Returns your bookmarks. Use \'nb\' or \'navb\' along with this.'],
+
+ 'commands' => [sub { commands(); }, 'Returns a list of commands.' ],
+ 'cmds' => [sub { commands(); }, 'Alias of \'commands\'.']
);
my @completions = keys %commands;
@@ -205,7 +208,7 @@ print $OUT "gmi.pl Copyright (C) 2022 Jake Thoughts\n";
print $OUT "This program comes with ABSOLUTELY NO WARRANTY.\n";
print $OUT "This is free software, and you are welcome to redisdtribute it\n";
print $OUT "under certain conditions. See COPYING for details.\n";
-print $OUT "Press <tab><tab> to see available commands.\n";
+print $OUT "Press <tab><tab> or 'cmds' to see available commands.\n";
while ( defined ($_ = $term->readline($prompt)) ) {
if ($_) {
my ($command, $detail, @other_details) = split(/\s/, $_);
@@ -1259,3 +1262,19 @@ sub begin_exit {
exit 0;
}
+
+sub commands {
+ my $cmds;
+ for (sort keys %commands) {
+ $cmds .= "$_ "
+ }
+
+ my $old_c = $wrapper->{columns};
+
+ my ($wc) = GetTerminalSize();
+ $wrapper->columns($wc);
+
+ print $OUT $wrapper->wrap($cmds);
+
+ $wrapper->columns($old_c);
+}