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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ zus base64 -f FILE_PATH

```Shell
zus dbase64 bXlfdGV4dA==
zus dbase64 -f bXlfdGV4dA== //store decoded data into txt file
zus dbase64 -o bXlfdGV4dA== //store decoded data into txt file
zus dbase64 -f FILE_PATH
```

> output: my_text
Expand Down
9 changes: 7 additions & 2 deletions Zus.Cli/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,14 @@
})
.WithDescription("Return encoded base64 of input.");

app.AddCommand("dbase64", async ([Option('f', Description = "Open decoded data in text editor")] bool? file, [Argument] string data) =>
app.AddCommand("dbase64", async ([Option('f', Description = "Read data from file")] bool? file, [Option('o', Description = "Open decoded data in text editor")] bool? output, [Argument] string data) =>
{
if (file.HasValue && file.Value == true)
if(file.HasValue && file.Value == true)
{
var fileReaderService = ServiceFactory.GetFileReaderService(data);
data = await fileReaderService.GetAsync();
}
if (output.HasValue && output.Value == true)
{
var tempFileService = ServiceFactory.GetTempFileService();
var decodeToFileResult = await Base64.DecodeToFile(tempFileService, data);
Expand Down