mirror of
https://github.com/Syping/ragephoto-cli.git
synced 2025-12-04 16:51:48 +01:00
set create output option default value to -
This commit is contained in:
parent
72ecad5c09
commit
601a34469a
1 changed files with 6 additions and 5 deletions
11
Commands.cs
11
Commands.cs
|
|
@ -6,7 +6,7 @@ namespace RagePhoto.Cli;
|
||||||
|
|
||||||
internal static class Commands {
|
internal static class Commands {
|
||||||
|
|
||||||
internal static Int32 CreateFunction(String format, String? jpegFile, String? description, String? json, String? title, String? outputFile) {
|
internal static Int32 CreateFunction(String format, String? jpegFile, String? description, String? json, String? title, String outputFile) {
|
||||||
try {
|
try {
|
||||||
using Photo photo = new();
|
using Photo photo = new();
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ internal static class Commands {
|
||||||
photo.Description = description ?? String.Empty;
|
photo.Description = description ?? String.Empty;
|
||||||
photo.Title = title ?? "Custom Photo";
|
photo.Title = title ?? "Custom Photo";
|
||||||
|
|
||||||
if (outputFile == "-" || String.IsNullOrEmpty(outputFile)) {
|
if (outputFile == "-" || outputFile == String.Empty) {
|
||||||
using MemoryStream photoStream = new(photo.Save());
|
using MemoryStream photoStream = new(photo.Save());
|
||||||
using Stream output = Console.OpenStandardOutput();
|
using Stream output = Console.OpenStandardOutput();
|
||||||
photoStream.CopyTo(output);
|
photoStream.CopyTo(output);
|
||||||
|
|
@ -296,8 +296,9 @@ internal static class Commands {
|
||||||
Option<String?> titleOption = new("--title", "-t") {
|
Option<String?> titleOption = new("--title", "-t") {
|
||||||
Description = "Photo Title"
|
Description = "Photo Title"
|
||||||
};
|
};
|
||||||
Option<String?> outputOption = new("--output", "-o") {
|
Option<String> outputOption = new("--output", "-o") {
|
||||||
Description = "Output File"
|
Description = "Output File",
|
||||||
|
DefaultValueFactory = _ => "-"
|
||||||
};
|
};
|
||||||
Command createCommand = new("create", "Create Photo") {
|
Command createCommand = new("create", "Create Photo") {
|
||||||
formatArgument, jpegOption, descriptionOption, jsonOption, titleOption, outputOption
|
formatArgument, jpegOption, descriptionOption, jsonOption, titleOption, outputOption
|
||||||
|
|
@ -308,7 +309,7 @@ internal static class Commands {
|
||||||
result.GetValue(descriptionOption),
|
result.GetValue(descriptionOption),
|
||||||
result.GetValue(jsonOption),
|
result.GetValue(jsonOption),
|
||||||
result.GetValue(titleOption),
|
result.GetValue(titleOption),
|
||||||
result.GetValue(outputOption))));
|
result.GetRequiredValue(outputOption))));
|
||||||
return createCommand;
|
return createCommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue