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/ImagineArt.CLI/Commands/ApiCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@

namespace ImagineArt.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(ImageEditingApiGroupCommand.Create());
command.Subcommands.Add(ImageGenerationApiGroupCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@

namespace ImagineArt.CLI.Commands;

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

public static Command Create()
{
var command = new Command(@"image-editing", @"ImageEditing endpoint commands.");
command.Subcommands.Add(ImageEditingRemoveBackgroundCommandApiCommand.Create());
command.Subcommands.Add(ImageEditingUpscaleImageCommandApiCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ internal static partial class ImageEditingRemoveBackgroundCommandApiCommand
};
private static readonly ImageFileRequestOptionSet ImageFileRequestOptionSetOptions = ImageFileRequestOptionSet.Create();

static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"remove-background", @"Background Remover API
Expand All @@ -36,6 +38,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 @@ -15,6 +15,8 @@ internal static partial class ImageEditingUpscaleImageCommandApiCommand
};
private static readonly ImageFileRequestOptionSet ImageFileRequestOptionSetOptions = ImageFileRequestOptionSet.Create();

static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"upscale-image", @"Image Upscale API
Expand All @@ -36,6 +38,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 @@ -4,13 +4,16 @@

namespace ImagineArt.CLI.Commands;

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

public static Command Create()
{
var command = new Command(@"image-generation", @"ImageGeneration endpoint commands.");
command.Subcommands.Add(ImageGenerationGenerateImageCommandApiCommand.Create());
command.Subcommands.Add(ImageGenerationGenerateTransparentImageCommandApiCommand.Create());
CustomizeCommand(ref command);
return command;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ internal static partial class ImageGenerationGenerateImageCommandApiCommand
Hidden = true,
};

static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"generate-image", @"Text to Image API
Expand Down Expand Up @@ -98,6 +100,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 @@ -42,6 +42,8 @@ internal static partial class ImageGenerationGenerateTransparentImageCommandApiC
Hidden = true,
};

static partial void CustomizeCommand(ref Command command);

public static Command Create()
{
var command = new Command(@"generate-transparent-image", @"Text to PNG API
Expand Down Expand Up @@ -88,6 +90,7 @@ await CliRuntime.RunAsync(async () =>

await CliRuntime.WriteBinaryAsync(parseResult, response, cancellationToken).ConfigureAwait(false);
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
11 changes: 9 additions & 2 deletions src/cli/ImagineArt.CLI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ dotnet tool install --global ImagineArt.CLI --prerelease

```bash
imagine-art --help
imagine-art api --help
```
imagine-art image-editing --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