summaryrefslogtreecommitdiff
path: root/exe
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-12-11 15:07:28 -0700
committermo khan <mo@mokhan.ca>2025-12-11 15:07:28 -0700
commit88617d035ad5828e430d4546430f7d855a5c0a24 (patch)
tree8ed38439f3f6d437db762cf732e4526e0ad8a152 /exe
parentecc324eb9fd20c6b48d65cb279e0afad6e5d886e (diff)
feat: export JSON files from the git repo
Diffstat (limited to 'exe')
-rwxr-xr-xexe/gitem18
1 files changed, 18 insertions, 0 deletions
diff --git a/exe/gitem b/exe/gitem
index 3c55a90..fca30f5 100755
--- a/exe/gitem
+++ b/exe/gitem
@@ -1,3 +1,21 @@
#!/usr/bin/env ruby
+# frozen_string_literal: true
require "gitem"
+
+if ARGV.empty?
+ puts "Usage: ruby #{$0} <path-to-git-repo> [output-directory]"
+ puts "Default output: <repo>/.git/srv/"
+ puts "Example: ruby #{$0} ."
+ exit 1
+end
+
+repo_path = ARGV[0]
+output_dir = ARGV[1]
+
+unless File.exist?(File.join(repo_path, '.git')) || File.exist?(File.join(repo_path, 'HEAD'))
+ puts "Error: #{repo_path} is not a valid git repository"
+ exit 1
+end
+
+Gitem::GitToJson.new(repo_path, output_dir).export!