@@ -566,51 +566,7 @@ ArgsDetails resolveArguments(string[] args, bool isDescribeOnly = false)
566566 if (res.helpWanted)
567567 {
568568 import std.getopt ;
569- string newCommands =
570- `
571- USAGE: redub [--version] [<command>] [<options...>] [-- [<application arguments...>]]
572-
573- Manages the redub project in the current directory. If the command is omitted,
574- redub will default to "run". When running an application, "--" can be used to
575- separate redub options from options passed to the application.
576-
577- Run "redub <command> --help" to get help for a specific command.
578-
579- Available commands
580- ==================
581-
582- Package creation
583- ----------------
584- init [<directory> [<dependency>...]]
585- Initializes an empty package skeleton
586-
587- Build, test and run
588- -------------------
589- run [<package>[@<version-spec>]]
590- Builds and runs a package (default command)
591- build [<package>[@<version-spec>]]
592- Builds a package (uses the main package in the current
593- working directory by default)
594- test [<package>[@<version-spec>]]
595- Executes the tests of the selected package
596- describe [<package>[@<version-spec>]]
597- Prints a description of the specified --data files
598- clean [<package>] Removes intermediate build files and cached build
599- results
600-
601- Additions to redub commands --
602-
603- update
604- Usage: redub update
605- Description: Updates with 'git pull' redub if the current redub is a git repository. If it is not, it will download the newest git tag from redub
606- repository. After updating the source, it will also optimally rebuild redub and replace the current one with the new build.
607- build-universal
608- Usage: redub build-universal
609- Description:
610- Builds a package in non OSX (uses the main package in the current working directory by default)
611- On OSX, generates a single binary using arm64 and x86_64 architectures
612- ` ;
613- defaultGetoptPrinter(RedubVersionShort~ " build information: \n\t " ~ newCommands, res.options);
569+ defaultGetoptPrinter(RedubVersionShort~ " build information: \n\t " ~ baseHelpInfo, res.options);
614570 return ArgsDetails.init;
615571 }
616572
@@ -926,4 +882,62 @@ private string getSubPackage(ref string pkg)
926882 string ret = pkg[subPackIndex+ 1 .. $];
927883 pkg = pkg[0 .. subPackIndex];
928884 return ret;
885+ }
886+
887+ immutable baseHelpInfo =
888+ `
889+ USAGE: redub [--version] [<command>] [<options...>] [-- [<application arguments...>]]
890+
891+ Manages the redub project in the current directory. If the command is omitted,
892+ redub will default to "run". When running an application, "--" can be used to
893+ separate redub options from options passed to the application.
894+
895+ Run "redub <command> --help" to get help for a specific command.
896+
897+ Available commands
898+ ==================
899+
900+ Package creation
901+ ----------------
902+ init [<directory> [<dependency>...]]
903+ Initializes an empty package skeleton
904+
905+ Build, test and run
906+ -------------------
907+ run [<package>[@<version-spec>]]
908+ Builds and runs a package (default command)
909+ build [<package>[@<version-spec>]]
910+ Builds a package (uses the main package in the current
911+ working directory by default)
912+ test [<package>[@<version-spec>]]
913+ Executes the tests of the selected package
914+ describe [<package>[@<version-spec>]]
915+ Prints a description of the specified --data files
916+ clean [<package>] Removes intermediate build files and cached build
917+ results
918+
919+ Additions to redub commands --
920+
921+ update
922+ Usage: redub update
923+ Description: Updates with 'git pull' redub if the current redub is a git repository. If it is not, it will download the newest git tag from redub
924+ repository. After updating the source, it will also optimally rebuild redub and replace the current one with the new build.
925+ build-universal
926+ Usage: redub build-universal
927+ Description:
928+ Builds a package in non OSX (uses the main package in the current working directory by default)
929+ On OSX, generates a single binary using arm64 and x86_64 architectures
930+ ` ;
931+
932+ string getHelpInfo ()
933+ {
934+ import std.getopt ;
935+ import std.array ;
936+ string [2 ] fakeArgs;
937+ string [] args = fakeArgs;
938+ DubArguments dub;
939+ GetoptResult res = betterGetopt(args, dub);
940+ Appender! string ret;
941+ defaultGetoptFormatter(&ret, RedubVersionShort~ " build information: \n\t " ~ baseHelpInfo, res.options);
942+ return ret.data;
929943}
0 commit comments