diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4aeb912..e448583 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -4,6 +4,7 @@ on: paths: - .github/workflows/deploy.yml - .github/scripts/* + - scripts/* pull_request: paths: - .github/workflows/deploy.yml diff --git a/README.md b/README.md index 21b1ef2..1724156 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,11 @@ To use the script the user would type `mash foo bar` or alternatively > letter category that you want an exception made, open a discussion and let’s > chat! +> [!INFO] +> ### Naming Guidelines: A Call for Consideration +> Think for a little about the names you are picking. We reserve the right +> to rename egregious abuse of names and namespaces. +   diff --git a/scripts/cache b/scripts/cache new file mode 100755 index 0000000..48362e3 --- /dev/null +++ b/scripts/cache @@ -0,0 +1,20 @@ +#!/usr/bin/env -S pkgx +mash bash + +usage() { + echo "usage: mash pkgx/cache " +} + +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 diff --git a/scripts/cache+ls b/scripts/cache+ls new file mode 100755 index 0000000..7e52bf8 --- /dev/null +++ b/scripts/cache+ls @@ -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") \ No newline at end of file diff --git a/scripts/upgrade.ts b/scripts/cache+upgrade.ts similarity index 100% rename from scripts/upgrade.ts rename to scripts/cache+upgrade.ts diff --git a/scripts/ls b/scripts/ls index 7e52bf8..f7a535a 100755 --- a/scripts/ls +++ b/scripts/ls @@ -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") \ No newline at end of file +exec mash pkgx/cache+ls "$@" \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100755 index 0000000..f1d85d6 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,3 @@ +#!/usr/bin/env -S pkgx +mash bash + +exec mash pkgx/cache+upgrade "$@"