From 0e829d4ea6c81567fc8daed35ae05d522a866a54 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 14 Mar 2022 01:34:36 -0400 Subject: Add commands(), updated readme --- README.md | 18 ++++++++++++++++-- gmi.pl | 23 +++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ac2bad5..0ee7969 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,33 @@ It has several dependencies which can be easily installed via cpan or cpanm. sudo cpanm IO::Socket::SSL URL::XS IO::Pager Text::Wraper Term::ReadKey Path::Naive Text::ParseWords Term::ReadLine Smart::Comments URI::Encode IO::Socket::SSL::Utils File::Slurper File::BaseDir TOML +* Clone the repo, in an approprate directory + +$ git clone http://git.jakesthoughts.xyz/dev/gemini-client + You should check the script to make sure that the dependencies list is up to date. +The author (me) recommends that you also install Term::ReadLine::Gnu so that tab will auto-complete commands. + ## Usage -Press the tab key twice to see the list of available commands. Use help in front of the command to get a description of what it does. +If you have Term::ReadLine::Gnu then you can use press the tab key twice to get a list of commands. Otherwise, use the command: 'commands' or the alias 'cmds' to get a list of commands and a brief description of what each command does. +Use help in front of the command to get a description of what it does. + +To get started: Use 'url', or it's alias, 'u' and type out a destination. +Here are some cool ones for you: +* gemini://astrobotany.mozz.us/ +* gemini://gemini.circumlunar.space/docs/specification.gmi +* gemini://geminispace.info/ + ## GUI You can get an experimental GUI version of this program by: $ git clone -b tk-gui http://git.jakesthoughts.xyz/dev/gemini-client -Please note that the GUI version of this software is EXPERIMENTAL and should not be considered a final product. It IS subject to change. +Do note that it is still in progress and no where near completed. Bugs and missing features are guaranteed. ## Windows I do not know if this software will work on Windows. I believe one of the dependencies is not Windows friendly but I forget which. 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 to see available commands.\n"; +print $OUT "Press 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); +} -- cgit v1.2.3