From ea83e80bf78d914ff647b5c57c1c900ea43eb21c Mon Sep 17 00:00:00 2001 From: KtorZ Date: Thu, 13 Apr 2023 10:04:24 +0200 Subject: [PATCH] Add a 'list' command to aikup. --- aikup/aikup | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/aikup/aikup b/aikup/aikup index b14dc3de..a5e4e11f 100755 --- a/aikup/aikup +++ b/aikup/aikup @@ -17,6 +17,10 @@ main() { --) shift; break;; install) shift; AIKUP_VERSION=$1;; + -l|--list) + list_versions + exit 0 + ;; -h|--help) usage exit 0 @@ -30,7 +34,7 @@ main() { if [ -z "$AIKUP_VERSION" ]; then err "must specify a version" - fi + fi # Print the banner after successfully parsing args banner @@ -116,6 +120,7 @@ USAGE: aikup OPTIONS: + -l, --list List available versions -h, --help Print help information SUBCOMMANDS: @@ -123,6 +128,11 @@ SUBCOMMANDS: EOF } +list_versions() { + say "available versions" + curl -sSL "https://api.github.com/repos/aiken-lang/aiken/tags" | grep -E '"name": "v' | sed 's/.*\(v[^"]*\)",.*/\1/' +} + say() { printf "aikup: %s\n" "$1" } @@ -153,27 +163,26 @@ ensure() { if ! "$@"; then err "command failed: $*"; fi } -# Banner Function for Aiken +# Banner Function for Aiken banner() { printf ' -.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx - - ╔═╗ ╦ ╔╦ ║ ╔══ ╔╗╔ Modern and modular toolkit - ╠═╣ ║ ╠═╣ ╠═ ║║║ for Cardano Smart Contract Development - ╚ ╝ ╩ ╚ ╚ ╚══ ╝╚╝ written in Rust. +================================================================================ -.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx +░█▀▀▄░▀█▀░▒█░▄▀░▒█▀▀▀░▒█▄░▒█ Modern and modular toolkit +▒█▄▄█░▒█░░▒█▀▄░░▒█▀▀▀░▒█▒█▒█ for Cardano Smart Contract development. +▒█░▒█░▄█▄░▒█░▒█░▒█▄▄▄░▒█░░▀█ Written in Rust. + +================================================================================ Repo : https://github.com/aiken-lang/aiken -Docs : https://aiken-lang.org/ -Chat : https://discord.gg/Vc3x8N9nz2 +Docs : https://aiken-lang.org/ +Chat : https://discord.gg/Vc3x8N9nz2 Contribute : https://github.com/aiken-lang/aiken/blob/main/CONTRIBUTING.md -.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx - +================================================================================ ' } -main "$@" || exit 1 \ No newline at end of file +main "$@" || exit 1