From a7ce2c272e3363311c14292ded3e0ac0546572e1 Mon Sep 17 00:00:00 2001 From: qorg11 Date: Thu, 18 Nov 2021 09:30:48 +0100 Subject: [PATCH] Added documentation directly in the script rather than a manpage --- doc/peertube-cli.1 | 36 ------------------------------------ peertube-cli | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 38 deletions(-) delete mode 100644 doc/peertube-cli.1 diff --git a/doc/peertube-cli.1 b/doc/peertube-cli.1 deleted file mode 100644 index f94b0e6..0000000 --- a/doc/peertube-cli.1 +++ /dev/null @@ -1,36 +0,0 @@ -.TH peertube-cli 1 2021-11-07 KILL-9 - -.SH NAME -peertube-cli \- A peertube CLI client. -.SH SYPNOSIS -.B peertube-cli -[\-\-instance=INSTANCE] [\-\-resolution=[0|1|...|n]] [\-\-player=PLAYER] [URL] -.SH DESCRIPTION -peertube-cli is a peertube client. If no parameters are given, it will -use the config file -.B -~/.ptclirc -or anything in the -.B -PTCLIRC -env -.SH CONFIG -The file -.B -~/.ptclirc -is written in perl using perl's hashes. And it contains 3 -values, instance, resolution and player. peertube-cli will use the -values set in this file if nothing is passed with getopt arguments. -.SH CONSIDERATIONS - -using peertube-cli might be harmful for PeerTube instances, as you're -downloading the video -.B from the server -rather from peers, so you'd be consuming more server bandwith thus -making it slowler. -.SH LICENSE - -peertube-cli is under the GPLv3 or any later. -.SH BUGS - -Of course. diff --git a/peertube-cli b/peertube-cli index 3c85727..0579a90 100755 --- a/peertube-cli +++ b/peertube-cli @@ -23,7 +23,9 @@ use Term::ReadLine; use Term::ANSIColor; use Getopt::Long; use Time::Seconds; -use Scalar::Util qw(looks_like_number); +use Scalar::Util qw(looks_like_number); +use Pod::Usage; + use strict; our %config; @@ -56,7 +58,9 @@ GetOptions( "instance|i=s" => \$config{instance}, "resolution|r=i" => \$config{default_resolution}, "player|p=s" => \$config{player}, - "player-flags|f=s" => \$config{player_flags} + "player-flags|f=s" => \$config{player_flags}, + "help|h" => sub {pod2usage(1); exit;}, + "man|m" => sub {pod2usage(-exitval => 0, -verbose=> 2); exit;}, ); # Main program while (1) { @@ -213,4 +217,37 @@ sub help_prompt() { print "Press enter to continue\n"; ; } +__END__ +=head1 peertube-cli + +peertube-cli - PeerTube Viewer + +=head1 SYNOPSIS + +peertube-cli [--instance] [--player] [--resolution] [search query] + +=head1 DESCRIPTION + +This program is a peertube client which allows you to browse any +instance using PeerTube's API. + +=head1 OPTIONS + +=over 4 + +=item B<-instance>: +peertube instance to use, because of bugs, it must not end with a "/" + +=item B<-resolution>: +by default 0 which is the highest resolution available. + +=item B<-player>: +which media player to use, by default is mpv. + +=item B<-player-flags>: +flags to append to the video player (-vo=x11 for example) + +=back + +=cut