mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2025-01-08 06:22:43 +00:00
add --version
This commit is contained in:
parent
529f009c48
commit
13072ecc79
3 changed files with 15 additions and 4 deletions
|
@ -181,9 +181,10 @@ public static class Help
|
|||
--relax-filtering Slightly relax file filtering in aggregate mode to include
|
||||
more results
|
||||
|
||||
Help
|
||||
Other
|
||||
-h, --help [option] [all|input|download-modes|search|name-format|
|
||||
file-conditions|config|shortcuts]
|
||||
--version Print program version and exit
|
||||
|
||||
Notes
|
||||
Acronyms of two- and --three-word-flags are also accepted, e.g. --twf. If the option
|
||||
|
@ -523,7 +524,12 @@ public static class Help
|
|||
Console.WriteLine(text);
|
||||
}
|
||||
|
||||
public static void PrintHelpAndExitIfNeeded(string[] args)
|
||||
public static void PrintVersion()
|
||||
{
|
||||
Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version);
|
||||
}
|
||||
|
||||
public static void PrintAndExitIfNeeded(string[] args)
|
||||
{
|
||||
int helpIdx = Array.FindLastIndex(args, x => x == "--help" || x == "-h");
|
||||
if (args.Length == 0 || helpIdx >= 0)
|
||||
|
@ -531,6 +537,11 @@ public static class Help
|
|||
PrintHelp(helpIdx + 1 < args.Length ? args[helpIdx + 1] : null);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else if (args.Contains("--version"))
|
||||
{
|
||||
PrintVersion();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ static partial class Program
|
|||
{
|
||||
Console.ResetColor();
|
||||
Console.OutputEncoding = System.Text.Encoding.UTF8;
|
||||
Help.PrintHelpAndExitIfNeeded(args);
|
||||
Help.PrintAndExitIfNeeded(args);
|
||||
|
||||
var config = new Config(args);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>sldl</AssemblyName>
|
||||
<VersionPrefix>2.4.0</VersionPrefix>
|
||||
<VersionPrefix>2.4.1</VersionPrefix>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
|
|
Loading…
Reference in a new issue