Skip to content

Commit

Permalink
Add -v argument to protobufdumper
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Oct 1, 2024
1 parent f49cddc commit 7cb1be2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions Resources/ProtobufDumper/ProtobufDumper/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;

namespace ProtobufDumper
{
Expand All @@ -11,8 +12,8 @@ static void Main( string[] args )
{
Environment.ExitCode = 0;

var namedArgs = new List<String>();
var unnamedArgs = new List<String>();
var namedArgs = new List<string>();
var unnamedArgs = new List<string>();

foreach ( var arg in args )
{
Expand All @@ -24,6 +25,13 @@ static void Main( string[] args )

if ( unnamedArgs.Count == 0 )
{
if ( namedArgs.Contains( "-v" ) )
{
var version = typeof( Program ).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
Console.WriteLine( $"{nameof( ProtobufDumper )} version: {version}" );
return;
}

Console.WriteLine( "No target specified." );

Environment.ExitCode = -1;
Expand All @@ -32,7 +40,7 @@ static void Main( string[] args )

var hasDumpCandidates = namedArgs.Contains( "-dump", StringComparer.OrdinalIgnoreCase );

var targets = new List<String>();
var targets = new List<string>();
string output = null;

for ( var i = 0; i < unnamedArgs.Count; i++ )
Expand Down
4 changes: 2 additions & 2 deletions Resources/ProtobufDumper/ProtobufDumper/ProtobufDumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ void DumpFileDescriptor( FileDescriptorProto proto, StringBuilder sb )
{
var dependency = proto.dependency[ i ];
var modifier = string.Empty;
if( proto.public_dependency.Contains( i ) )

if ( proto.public_dependency.Contains( i ) )
{
modifier = "public ";
}
Expand Down

0 comments on commit 7cb1be2

Please sign in to comment.