From 24ecef20156985f543362cdb77df027bfe49f536 Mon Sep 17 00:00:00 2001 From: liam4 Date: Thu, 8 Jun 2017 10:19:59 -0300 Subject: Help message --- man/http-music.1 | 5 +++++ src/play.js | 14 ++++++++++++++ todo.txt | 1 + 3 files changed, 20 insertions(+) diff --git a/man/http-music.1 b/man/http-music.1 index 4a7e824..625b174 100644 --- a/man/http-music.1 +++ b/man/http-music.1 @@ -33,6 +33,11 @@ This does not effect the source playlist, so specific groups can be selected usi Sets the downloader type used for actually retrieving track files. The default is \fBhttp\fR. +.TP +.BR \-h ", " \-? ", " \-\-help +Presents a help message, directing the user to the \fBman\fR page. +If this is the last option used, nothing plays (see \fB\-\-play\fR). + .TP .BR \-k ", " \-\-keep " \fIgroupPath\fR" Keeps a group by adding it from the source playlist. diff --git a/src/play.js b/src/play.js index 7023d9f..fee1b79 100755 --- a/src/play.js +++ b/src/play.js @@ -48,6 +48,20 @@ setupDefaultPlaylist('./playlist.json') } await processArgv(process.argv, { + '-help': function(util) { + // --help (alias: -h, -?) + // Presents a help message. + + console.log('http-music\nTry man http-music!') + + if (util.index === util.argv.length - 1) { + shouldPlay = false + } + }, + + 'h': util => util.alias('-help'), + '?': util => util.alias('-help'), + '-open': async function(util) { // --open (alias: -o) // Opens a separate playlist file. diff --git a/todo.txt b/todo.txt index c50bff5..4127bcc 100644 --- a/todo.txt +++ b/todo.txt @@ -91,3 +91,4 @@ TODO: Make a way to skip tracks while playing. Currently the only way is to forces the user to wait for another one to be downloaded. TODO: Make a --help/-h/-? option that directs helpless users to the man page. + (Done!) -- cgit 1.3.0-6-gf8a5