-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have our cache admin scripts be their own stem
- Loading branch information
Showing
7 changed files
with
68 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env -S pkgx +mash bash | ||
|
||
usage() { | ||
echo "usage: mash pkgx/cache <ls|upgrade>" | ||
} | ||
|
||
cmd="$1" | ||
shift | ||
|
||
case "$cmd" in | ||
neophile|neophilia|neophiliac) | ||
exec pkgx mash "pkgx/cache+upgrade" "$@";; | ||
ls|cache) | ||
exec pkgx mash "pkgx/cache+$cmd" "$@";; | ||
--help) | ||
usage;; | ||
*) | ||
usage | ||
exit 64; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env -S pkgx +gum +gem bash | ||
|
||
ruby "$0" | gum format | ||
exit 0 | ||
|
||
#!/usr/bin/ruby | ||
require 'pathname' | ||
|
||
def find_versions(dir, result) | ||
Dir.foreach(dir) do |entry| | ||
next if entry == '.' || entry == '..' # Skip current and parent directories | ||
|
||
path = File.join(dir, entry) | ||
|
||
if File.directory?(path) && !File.symlink?(path) | ||
if entry =~ /^v\d+\./ | ||
version = entry.sub(/^v/, '') | ||
parent_dir = Pathname.new(dir).relative_path_from($pkgx_dir) | ||
result << "| #{parent_dir} | #{version} |" | ||
else | ||
find_versions(path, result) # Recursively call for subdirectories | ||
end | ||
end | ||
end | ||
end | ||
|
||
# Define the path to the .pkgx directory | ||
$pkgx_dir = File.expand_path('~/.pkgx') | ||
result = [] | ||
|
||
# Start the recursive search | ||
find_versions($pkgx_dir, result) | ||
|
||
# Output the Markdown table | ||
puts "| Parent Directory | Version |" | ||
puts "|------------------|---------|" | ||
puts result.join("\n") |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,3 @@ | ||
#!/usr/bin/env -S pkgx +gum +gem bash | ||
#!/usr/bin/env -S pkgx +mash bash | ||
|
||
ruby "$0" | gum format | ||
exit 0 | ||
|
||
#!/usr/bin/ruby | ||
require 'pathname' | ||
|
||
def find_versions(dir, result) | ||
Dir.foreach(dir) do |entry| | ||
next if entry == '.' || entry == '..' # Skip current and parent directories | ||
|
||
path = File.join(dir, entry) | ||
|
||
if File.directory?(path) && !File.symlink?(path) | ||
if entry =~ /^v\d+\./ | ||
version = entry.sub(/^v/, '') | ||
parent_dir = Pathname.new(dir).relative_path_from($pkgx_dir) | ||
result << "| #{parent_dir} | #{version} |" | ||
else | ||
find_versions(path, result) # Recursively call for subdirectories | ||
end | ||
end | ||
end | ||
end | ||
|
||
# Define the path to the .pkgx directory | ||
$pkgx_dir = File.expand_path('~/.pkgx') | ||
result = [] | ||
|
||
# Start the recursive search | ||
find_versions($pkgx_dir, result) | ||
|
||
# Output the Markdown table | ||
puts "| Parent Directory | Version |" | ||
puts "|------------------|---------|" | ||
puts result.join("\n") | ||
exec mash pkgx/cache+ls "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env -S pkgx +mash bash | ||
|
||
exec mash pkgx/cache+upgrade "$@" |