diff --git a/README.md b/README.md index b398788..19f4b8b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Zus.Cli/Program.cs b/Zus.Cli/Program.cs index 198ba0a..5bbf3c7 100644 --- a/Zus.Cli/Program.cs +++ b/Zus.Cli/Program.cs @@ -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);