From 43f68e97908bd50d379a6aa3b587f6241a54eeda Mon Sep 17 00:00:00 2001 From: Rucciva Date: Fri, 23 Aug 2024 19:08:42 +0700 Subject: [PATCH] refactor --- README.md | 12 ++++++++++++ testdata/.b64f | 4 ++-- testdata/a/bb/ccc/{f => file.ext} | 0 testdata/a/bb/ccc/{f.b64 => file.ext.b64} | 0 testdata/a/bb/{f => file} | 0 testdata/a/bb/{f.b64 => file.b64} | 0 testdata/makefile | 4 ++-- 7 files changed, 16 insertions(+), 4 deletions(-) rename testdata/a/bb/ccc/{f => file.ext} (100%) rename testdata/a/bb/ccc/{f.b64 => file.ext.b64} (100%) rename testdata/a/bb/{f => file} (100%) rename testdata/a/bb/{f.b64 => file.b64} (100%) diff --git a/README.md b/README.md index 7cdcb57..e3e6150 100644 --- a/README.md +++ b/README.md @@ -23,4 +23,16 @@ Base64 Encode/Decode multiple files. go run -mod=mod github.com/telkomindonesia/b64f decode ``` +## Tips + +You can use `makefie` to make the command simpler, for example: + +```makefile +b64f: mode ?= "decode" +b64f: + go run -mod=mod github.com/telkomindonesia/b64f $(mode) +``` + +which can then be used using `make b64f` or `make b64f mode=encode` + see [testdata](./testdata/) folder for example. diff --git a/testdata/.b64f b/testdata/.b64f index f310e9b..bd797f2 100644 --- a/testdata/.b64f +++ b/testdata/.b64f @@ -1,2 +1,2 @@ -a/bb/ccc/* -a/bb/f \ No newline at end of file +a/bb/**/*.ext +a/* \ No newline at end of file diff --git a/testdata/a/bb/ccc/f b/testdata/a/bb/ccc/file.ext similarity index 100% rename from testdata/a/bb/ccc/f rename to testdata/a/bb/ccc/file.ext diff --git a/testdata/a/bb/ccc/f.b64 b/testdata/a/bb/ccc/file.ext.b64 similarity index 100% rename from testdata/a/bb/ccc/f.b64 rename to testdata/a/bb/ccc/file.ext.b64 diff --git a/testdata/a/bb/f b/testdata/a/bb/file similarity index 100% rename from testdata/a/bb/f rename to testdata/a/bb/file diff --git a/testdata/a/bb/f.b64 b/testdata/a/bb/file.b64 similarity index 100% rename from testdata/a/bb/f.b64 rename to testdata/a/bb/file.b64 diff --git a/testdata/makefile b/testdata/makefile index 2f3c9ae..8bcf278 100644 --- a/testdata/makefile +++ b/testdata/makefile @@ -1,4 +1,4 @@ -B64F_MODE ?= "decode" +b64f: mode ?= "decode" b64f: - go run .. $(B64F_MODE) + go run .. $(mode) \ No newline at end of file