Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/cli/Beatoven.CLI/Beatoven.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
<Nullable>enable</Nullable>
<LangVersion>preview</LangVersion>
<PackAsTool>true</PackAsTool>
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
<PackageId>Beatoven.CLI</PackageId>
<ToolCommandName>beatoven</ToolCommandName>
<UserSecretsId>Beatoven.CLI</UserSecretsId>
<MinVerTagPrefix>v</MinVerTagPrefix>
<MinVerDefaultPreReleaseIdentifiers>dev</MinVerDefaultPreReleaseIdentifiers>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MinVer" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.7" />
<ProjectReference Include="../../libs/Beatoven/Beatoven.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

Expand All @@ -22,18 +23,18 @@ internal static partial class TracksComposeTrackCommandApiCommand
private static Option<bool?> Looping { get; } = CliRuntime.CreateNullableBoolOption(
name: @"--looping",
description: @"Set `true` for a higher amount of looping. Default `false`.");
private static Option<string?> Input { get; } = new("--input")
private static Option<string?> Input { get; } = new(@"--input")
{
Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.",
};

private static Option<string?> RequestJson { get; } = new("--request-json")
private static Option<string?> RequestJson { get; } = new(@"--request-json")
{
Description = "Request body as JSON.",
Hidden = true,
};

private static Option<string?> RequestFile { get; } = new("--request-file")
private static Option<string?> RequestFile { get; } = new(@"--request-file")
{
Description = "Path to a JSON request file, or '-' for stdin.",
Hidden = true,
Expand Down Expand Up @@ -80,7 +81,7 @@ Returns a task ID that can be polled via `GET /api/v1/tasks/{task_id}`
var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0);
if (specifiedCount > 1)
{
result.AddError("Specify at most one of --input, --request-json, or --request-file.");
result.AddError(@"Specify at most one of --input, --request-json, or --request-file.");
}
});

Expand All @@ -95,8 +96,8 @@ await CliRuntime.RunAsync(async () =>
global::Beatoven.SourceGenerationContext.Default,
cancellationToken).ConfigureAwait(false);
var prompt = parseResult.GetRequiredValue(Prompt);
var format = parseResult.GetValue(Format) ?? __requestBase?.Format;
var looping = parseResult.GetValue(Looping) ?? __requestBase?.Looping;
var format = CliRuntime.WasSpecified(parseResult, Format) ? parseResult.GetValue(Format) : __requestBase is not null ? __requestBase.Format : default;
var looping = CliRuntime.WasSpecified(parseResult, Looping) ? parseResult.GetValue(Looping) : __requestBase is not null ? __requestBase.Looping : default;
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


Expand Down