From 1f36fb608aea446e6b5a35ba268164502ea2c9a4 Mon Sep 17 00:00:00 2001 From: Alexey Golub Date: Fri, 12 Jan 2018 23:29:16 +0200 Subject: [PATCH] Improve CLI help output --- DiscordChatExporter.Cli/Program.cs | 46 +++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/DiscordChatExporter.Cli/Program.cs b/DiscordChatExporter.Cli/Program.cs index fd356a68..49c2115c 100644 --- a/DiscordChatExporter.Cli/Program.cs +++ b/DiscordChatExporter.Cli/Program.cs @@ -9,6 +9,39 @@ namespace DiscordChatExporter.Cli { private static readonly Container Container = new Container(); + private static void ShowHelp() + { + var version = Assembly.GetExecutingAssembly().GetName().Version; + + Console.WriteLine($"=== Discord Chat Exporter (Command Line Interface) v{version} ==="); + Console.WriteLine(); + Console.WriteLine("[-t] [--token] Discord authorization token."); + Console.WriteLine("[-c] [--channel] Discord channel ID."); + Console.WriteLine("[-f] [--format] Export format (PlainText/HtmlDark/HtmlLight). Optional."); + Console.WriteLine("[-o] [--output] Output file path. Optional."); + Console.WriteLine(" [--datefrom] Limit to messages after this date. Optional."); + Console.WriteLine(" [--dateto] Limit to messages before this date. Optional."); + Console.WriteLine(" [--dateformat] Date format. Optional."); + Console.WriteLine(" [--grouplimit] Message group limit. Optional."); + Console.WriteLine(); + Console.WriteLine("# To get authorization token:"); + Console.WriteLine(" - Open Discord app"); + Console.WriteLine(" - Log in if you haven't"); + Console.WriteLine(" - Press Ctrl+Shift+I"); + Console.WriteLine(" - Navigate to Application tab"); + Console.WriteLine(" - Expand Storage > Local Storage > https://discordapp.com"); + Console.WriteLine(" - Find \"token\" under key and copy the value"); + Console.WriteLine(); + Console.WriteLine("# To get channel ID:"); + Console.WriteLine(" - Open Discord app"); + Console.WriteLine(" - Log in if you haven't"); + Console.WriteLine(" - Go to any channel you want to export"); + Console.WriteLine(" - Press Ctrl+Shift+I"); + Console.WriteLine(" - Navigate to Console tab"); + Console.WriteLine(" - Type \"document.URL\" and press Enter"); + Console.WriteLine(" - Copy the long sequence of numbers after last slash"); + } + private static CliOptions ParseOptions(string[] args) { var argsParser = new FluentCommandLineParser(); @@ -29,17 +62,7 @@ namespace DiscordChatExporter.Cli // Show help if no arguments if (parsed.EmptyArgs) { - var version = Assembly.GetExecutingAssembly().GetName().Version; - Console.WriteLine($"=== Discord Chat Exporter (Command Line Interface) v{version} ==="); - Console.WriteLine(); - Console.WriteLine("[-t] [--token] Discord authorization token."); - Console.WriteLine("[-c] [--channel] Discord channel ID."); - Console.WriteLine("[-f] [--format] Export format (PlainText/HtmlDark/HtmlLight). Optional."); - Console.WriteLine("[-o] [--output] Output file path. Optional."); - Console.WriteLine(" [--datefrom] Limit to messages after this date. Optional."); - Console.WriteLine(" [--dateto] Limit to messages before this date. Optional."); - Console.WriteLine(" [--dateformat] Date format. Optional."); - Console.WriteLine(" [--grouplimit] Message group limit. Optional."); + ShowHelp(); Environment.Exit(0); } // Show error if there are any @@ -77,6 +100,7 @@ namespace DiscordChatExporter.Cli // Cleanup container Container.Cleanup(); + Console.WriteLine("Export complete."); } }