diff --git a/bin/main.dart b/bin/main.dart index 599f02c..b9cbe2d 100644 --- a/bin/main.dart +++ b/bin/main.dart @@ -7,7 +7,7 @@ import 'package:funkblubber/parsing/parser.dart' as parser; void main(final List arguments) async { final result = parser.extract(arguments); if (!result.success) { - console.error("'funkblubber --help 'for more"); + console.error("'funkblubber --help' for more"); return; } diff --git a/lib/parsing/parser.dart b/lib/parsing/parser.dart index 6fccd46..3d41300 100644 --- a/lib/parsing/parser.dart +++ b/lib/parsing/parser.dart @@ -91,6 +91,44 @@ ParseResult extract(final List args) { return result; } +void _onHelpStage() { + final String help = ''' +usage: funkblubber [[-OPTIONS|URL]...] + + A simple CLI for interaction with your Funkwhale account. + + Options: + [-a|--album ID] Provide with album ID to download it. + + [-A|--artist ID] Provide with artist ID to download it and their albums. + + [-p|--path PATH] Provide to explicitly define download directory. + Assumed '.'. + + [-d|--domain DOMAIN] Provide to explicitly define the host where your + Funkwhale instance is. Required with -a, -A, and -u. + Is not required if you download by a full URL. + + Examples: + funkblubber https://my.funkwhale/library/tracks/10244/ + Download album by URL to current folder. + + funkblubber https://my.funkwhale/library/tracks/10244/ -p music + Download album by URL to local ./music folder. + + funkblubber -A 152 -d my.funkwhale -p media/music/ + Download everything by artist with ID 152 from a funkwhale instance + with my.funkwhale domain and save it to local ./media/music folder. + + funkblubber --album 1423 -d my.funkwhale + Download album with ID 1423 from a funkwhale instance + with my.funkwhale domain and save it to current folder. + + '''; + + console.info(help); +} + StageResult _onEntityStage( final String arg, final ParseResult previousResult, @@ -193,6 +231,11 @@ StageResult _onNothingStage( case '--domain': currentStage = ParsingStage.domain; break; + case '-h': + case '--help': + _onHelpStage(); + currentStage = ParsingStage.nothing; + break; default: try { final Uri uri = Uri.parse(arg);