File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env -S pkgx +gum +gem bash
2
+
3
+ ruby "$0" | gum format
4
+ exit 0
5
+
6
+ #!/usr/bin/ruby
7
+ require 'pathname'
8
+
9
+ def find_versions(dir, result)
10
+ Dir.foreach(dir) do |entry|
11
+ next if entry == '.' || entry == '..' # Skip current and parent directories
12
+
13
+ path = File.join(dir, entry)
14
+
15
+ if File.directory?(path) && !File.symlink?(path)
16
+ if entry =~ /^v\d+\./
17
+ version = entry.sub(/^v/, '')
18
+ parent_dir = Pathname.new(dir).relative_path_from($pkgx_dir)
19
+ result << "| #{parent_dir} | #{version} |"
20
+ else
21
+ find_versions(path, result) # Recursively call for subdirectories
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ # Define the path to the .pkgx directory
28
+ $pkgx_dir = File.expand_path('~/.pkgx')
29
+ result = []
30
+
31
+ # Start the recursive search
32
+ find_versions($pkgx_dir, result)
33
+
34
+ # Output the Markdown table
35
+ puts "| Parent Directory | Version |"
36
+ puts "|------------------|---------|"
37
+ puts result.join("\n")
You can’t perform that action at this time.
0 commit comments