aboutsummaryrefslogtreecommitdiff
path: root/cmd/main.go
diff options
context:
space:
mode:
authorishaan <contact@ishaan.cc>2026-07-11 21:45:55 +0530
committerishaan <contact@ishaan.cc>2026-07-11 21:45:55 +0530
commitcfbacac3872a98303481a7930b8d497058499b30 (patch)
tree854120482c60012503adbf2174dd71af74600914 /cmd/main.go
parent44ebc4d6afe97ef0a2441961ccb5592e98276dc6 (diff)
ez
Diffstat (limited to 'cmd/main.go')
-rw-r--r--cmd/main.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmd/main.go b/cmd/main.go
new file mode 100644
index 0000000..9fa7a10
--- /dev/null
+++ b/cmd/main.go
@@ -0,0 +1,35 @@
+package main
+
+import "os"
+
+func main() {
+ initFlags()
+
+ if len(os.Args) < 2 {
+ usage()
+ }
+
+ opt := os.Args[1]
+
+ cmd, ok := commands[opt]
+ if !ok {
+ usage()
+ }
+
+ cmd.Parse(os.Args[2:])
+ args := cmd.Args()
+
+ if len(args) > 2 {
+ usage()
+ }
+
+ file := args[0]
+
+ switch opt {
+ case "encrypt":
+ rawEncryptFile(file)
+
+ case "decrypt":
+ rawDecryptFile(file)
+ }
+}