Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/tooling/docs-builder/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information

using System.Reflection;
using Documentation.Builder;
using Documentation.Builder.Commands;
using Documentation.Builder.Commands.Assembler;
Expand All @@ -15,7 +16,18 @@
using Nullean.Argh;
using Nullean.Argh.Hosting;

// Pre-host fast path: run --help, --version, __schema, __completion directly and exit
if (args is ["--version"])
{
var version = Assembly.GetExecutingAssembly()
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
?? Assembly.GetExecutingAssembly().GetName().Version?.ToString()
?? "unknown";

Console.WriteLine(version);
return;
}

// Pre-host fast path: run --help, __schema, __completion directly and exit
// before the host (and its startup logs) are ever constructed.
await ArghApp.TryArghIntrinsicCommand(args);

Expand Down
Loading