• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A CLI tool for downloading from pixiv.net


Commit MetaInfo

Révision795061d31427f4182928a4275d3fd9aabd5a8619 (tree)
l'heure2023-06-15 12:12:55
Auteurmio <stigma@disr...>
Commitermio

Message de Log

Provide better default help message

This will be displayed when there are no arguments provided or
when -h/--help/help is provided.

Change Summary

Modification

--- a/source/app.d
+++ b/source/app.d
@@ -1,6 +1,6 @@
11 /*
22 * pixiv_down - CLI-based downloading tool for https://www.pixiv.net.
3- * Copyright (C) 2023 mio <stigma@disroot.org>
3+ * Copyright (C) 2023 Mio
44 *
55 * This program is free software: you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
@@ -670,6 +670,32 @@ void printMainHelp(string progname, string msg = "")
670670 "available options");
671671 }
672672
673+void displayDefaultHelp(string programName)
674+{
675+ stderr.writefln(
676+ "pixiv_down - A tool for downloading from pixiv.net [version %s]\n" ~
677+ "\nUsage:\t%s <command> [options]\n" ~
678+ "\npixiv_down is a tool that allows you to download various content\n" ~
679+ "from the pixiv website. Currently it's limited to illustrations,\n" ~
680+ "however, work is being made on providing support for novels.\n" ~
681+ "\nMain Commands:\n" ~
682+ "\tartist \tDownload content from a specified artist.\n" ~
683+ "\tartwork \tDownload a specific artwork(s) via IDs.\n" ~
684+ "\tdaily \tDownload all followed users' content between dates.\n" ~
685+ "\tfollowing\tDownload all followed users' content by account.\n" ~
686+ "\nSide Commands:\n" ~
687+ "\thelp \tDisplay this help information and exit.\n" ~
688+ "\tversion \tDisplay the current version of pixiv_down.\n" ~
689+ "\nExamples:\n" ~
690+ "\n Download a single illustration:\n" ~
691+ " pixiv_down artwork 108985926\n" ~
692+ "\n Download all content from a user:\n" ~
693+ " pixiv_down artist 10109777\n" ~
694+ "\nYou can combine ``help'' with any of the main commands for more\n" ~
695+ "information and examples on the chosen command.",
696+ PixivDownVersionString, programName);
697+}
698+
673699 // Don't compile in |main| when building unittests.
674700 version(unittest) {} else:
675701
@@ -688,15 +714,15 @@ version(appimage) {
688714 ];
689715
690716 if (args.length < 2) {
691- printMainHelp(args[0], "no command specified");
692- return 1;
717+ displayDefaultHelp(args[0]);
718+ return 2;
693719 }
694720
695721 switch (args[1]) {
696722 case "-h":
697723 case "--help":
698724 case "help":
699- printMainHelp(args[0]);
725+ displayDefaultHelp(args[0]);
700726 return 0;
701727 case "-v":
702728 case "--version":