-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ea5d2c
commit bf9de45
Showing
14 changed files
with
171 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<PublishTrimmed>true</PublishTrimmed> | ||
<TieredCompilationQuickJit>false</TieredCompilationQuickJit> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<Version>1.0.0</Version> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="CommandLineParser" Version="2.7.82" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootDescriptor Include="TrimmerRoots.xml" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<_LastSelectedProfileId>D:\MonoLogueChi\Documents\GitHub\Danmu.Server\CommandLine\Properties\PublishProfiles\FolderProfile.pubxml</_LastSelectedProfileId> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
using CommandLine; | ||
using Danmu.CommandLine.Utils; | ||
|
||
namespace Danmu.CommandLine | ||
{ | ||
internal class Program | ||
{ | ||
private static void Main(string[] args) | ||
{ | ||
Parser.Default.ParseArguments<Options>(args) | ||
.WithParsed(RunOptions) | ||
.WithNotParsed(HandleParseError); | ||
} | ||
|
||
private static void RunOptions(Options opts) | ||
{ | ||
if (opts.Version) | ||
Console.WriteLine((Assembly.GetEntryAssembly() ?? throw new InvalidOperationException()) | ||
.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion); | ||
} | ||
|
||
private static void HandleParseError(IEnumerable<Error> errs) | ||
{ | ||
//handle errors | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
CommandLine/Properties/PublishProfiles/FolderProfile.pubxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<PublishProtocol>FileSystem</PublishProtocol> | ||
<Configuration>Release</Configuration> | ||
<Platform>Any CPU</Platform> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir> | ||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||
<SelfContained>true</SelfContained> | ||
<PublishSingleFile>True</PublishSingleFile> | ||
<PublishReadyToRun>False</PublishReadyToRun> | ||
<PublishTrimmed>True</PublishTrimmed> | ||
</PropertyGroup> | ||
</Project> |
6 changes: 6 additions & 0 deletions
6
CommandLine/Properties/PublishProfiles/FolderProfile.pubxml.user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<linker> | ||
<assembly fullname="CommandLine" preserve="all"/> | ||
</linker> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.Collections.Generic; | ||
using CommandLine; | ||
|
||
namespace Danmu.CommandLine.Utils | ||
{ | ||
public class Options | ||
{ | ||
[Option('v', "version", Required = false, HelpText = "程序版本")] | ||
public bool Version { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<linker> | ||
<assembly fullname="Microsoft.AspNetCore" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.Cors" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.Authorization" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.Authentication.Cookies" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.Mvc.Core" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.Hosting" preserve="all"/> | ||
<assembly fullname="Microsoft.AspNetCore.HttpOverrides" preserve="all"/> | ||
|
||
<assembly fullname="Microsoft.EntityFrameworkCore" preserve="all"/> | ||
<assembly fullname="Npgsql.EntityFrameworkCore.PostgreSQL" preserve="all"/> | ||
|
||
<assembly fullname="Microsoft.Extensions.Identity.Core" preserve="all"/> | ||
<assembly fullname="Microsoft.Extensions.Configuration.Binder" preserve="all"/> | ||
|
||
<assembly fullname="System.ComponentModel.Annotations" preserve="all"/> | ||
</linker> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters