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
5 changes: 4 additions & 1 deletion src/cli/Pruna.CLI/Commands/ApiCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

namespace Pruna.CLI.Commands;

internal static class ApiCommand
internal static partial class ApiCommand
{
static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command("api", "Generated endpoint commands.");

command.Subcommands.Add(DefaultApiGroupCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ private static string FormatResponse(ParseResult parseResult, global::Pruna.Pred
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"create-prediction", @"Create a prediction for a Pruna model.");
Expand Down Expand Up @@ -76,6 +78,7 @@ await CliRuntime.WriteResponseAsync(
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
5 changes: 4 additions & 1 deletion src/cli/Pruna.CLI/Commands/DefaultApiGroupCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

namespace Pruna.CLI.Commands;

internal static class DefaultApiGroupCommand
internal static partial class DefaultApiGroupCommand
{
static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"default", @"default endpoint commands.");
Expand All @@ -14,6 +16,7 @@ public static Command Create()
command.Subcommands.Add(GetPredictionDeliveryCommandApiCommand.Create());
command.Subcommands.Add(GetPredictionStatusCommandApiCommand.Create());
command.Subcommands.Add(UploadFileCommandApiCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
3 changes: 3 additions & 0 deletions src/cli/Pruna.CLI/Commands/GetFileCommandApiCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ private static string FormatResponse(ParseResult parseResult, global::Pruna.File
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"get-file", @"Get uploaded file metadata.");
Expand All @@ -58,6 +60,7 @@ await CliRuntime.WriteResponseAsync(
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ internal static partial class GetPredictionDeliveryCommandApiCommand
Description = @"",
};

static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"get-prediction-delivery", @"Download or retrieve a generated prediction artifact.");
Expand All @@ -32,6 +34,7 @@ await CliRuntime.RunAsync(async () =>

await CliRuntime.WriteBinaryAsync(parseResult, response, cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ private static string FormatResponse(ParseResult parseResult, global::Pruna.Pred
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"get-prediction-status", @"Get prediction status and result metadata.");
Expand All @@ -58,6 +60,7 @@ await CliRuntime.WriteResponseAsync(
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
3 changes: 3 additions & 0 deletions src/cli/Pruna.CLI/Commands/UploadFileCommandApiCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ private static string FormatResponse(ParseResult parseResult, global::Pruna.File
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"upload-file", @"Upload a file for prediction inputs.");
Expand Down Expand Up @@ -69,6 +71,7 @@ await CliRuntime.WriteResponseAsync(
FormatResponse,
cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
11 changes: 9 additions & 2 deletions src/cli/Pruna.CLI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ dotnet tool install --global Pruna.CLI --prerelease

```bash
pruna --help
pruna api --help
```
pruna default --help
```

## Customization

Generated operation, tag, and API group command classes are partial. Implement
`static partial void CustomizeCommand(ref Command command)` in a separate source
file to add aliases or validators, change the action, or replace a command. The
hook runs after the generated command has been configured.
Loading