From b9375748cbf64404515ca1c62c237db43bd11caa Mon Sep 17 00:00:00 2001 From: Tirito6626 Date: Thu, 2 Jul 2026 12:50:00 +0000 Subject: [PATCH 1/2] initial commit --- amethyst.ini | 2 +- lib/deps/_utils.ab | 4 ++-- lib/path.ab | 6 ++---- src/commands/amber/_mod.ab | 20 ++++++++++---------- src/commands/amber/install.ab | 18 +++++++++--------- src/commands/amber/list.ab | 14 +++++++------- src/commands/amber/uninstall.ab | 14 +++++++------- src/commands/amber/use.ab | 18 +++++++++--------- src/commands/deps/add.ab | 8 ++++---- src/commands/deps/install.ab | 8 ++++---- src/commands/deps/remove.ab | 8 ++++---- src/commands/env.ab | 2 +- src/commands/init.ab | 4 ++-- src/main.ab | 32 ++++++++++++++++---------------- 14 files changed, 78 insertions(+), 80 deletions(-) diff --git a/amethyst.ini b/amethyst.ini index eb5f05f..b709d4e 100644 --- a/amethyst.ini +++ b/amethyst.ini @@ -1,5 +1,5 @@ [amethyst] -amber-version = 0.5.1-alpha +amber-version = amber-0.6.0-alpha [dependencies] xylitol = https://github.com/zlfn/xylitol.git diff --git a/lib/deps/_utils.ab b/lib/deps/_utils.ab index 90202b4..121c161 100644 --- a/lib/deps/_utils.ab +++ b/lib/deps/_utils.ab @@ -10,9 +10,9 @@ pub fun list_deps() { const project = project[1] const dependencies = get_project_properties(project, "dependencies") - echo "{len(dependencies)} Dependencies:" + echo("{len(dependencies)} Dependencies:") for dep in dependencies { const target = get_project_property(project, "dependencies", dep) - echo "- {dep} ({target})" + echo("- {dep} ({target})") } } diff --git a/lib/path.ab b/lib/path.ab index 13b6dc3..3e4733e 100644 --- a/lib/path.ab +++ b/lib/path.ab @@ -7,13 +7,11 @@ pub fun relative(path: Text): Text { } pub fun realpath(path: Text): Text { - const path = trust $ realpath "{path}" $ - return path + return trust $ realpath "{path}" $ } pub fun parent_dir(dir: Text): Text { - const path = trust $ dirname "{dir}" $ - return realpath(path) + return realpath(trust $ dirname "{dir}" $) } pub fun basename(path: Text): Text { diff --git a/src/commands/amber/_mod.ab b/src/commands/amber/_mod.ab index dad9ed6..56de098 100644 --- a/src/commands/amber/_mod.ab +++ b/src/commands/amber/_mod.ab @@ -7,16 +7,16 @@ import { cmd_amber_uninstall } from "./uninstall.ab" import { info, fatal } from "../../../lib/utils.ab" fun show_help_and_exit(code: Num = 0) { - echo "Usage: amethyst amber [options]" - echo "" - echo "Commands:" - echo " list List available amber versions" - echo " use Change the default amber version" - echo " install Install a specific amber version" - echo " uninstall Remove a specific amber version" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst amber [options]") + echo("") + echo("Commands:") + echo(" list List available amber versions") + echo(" use Change the default amber version") + echo(" install Install a specific amber version") + echo(" uninstall Remove a specific amber version") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(code) } diff --git a/src/commands/amber/install.ab b/src/commands/amber/install.ab index 07c8f66..7d4838b 100644 --- a/src/commands/amber/install.ab +++ b/src/commands/amber/install.ab @@ -6,15 +6,15 @@ import { get_amber_tags } from "../../../lib/github.ab" import { get_local_versions, is_available_locally, download } from "../../../lib/amber_manager.ab" fun show_help_and_exit(code: Num = 0): Null { - echo "Usage: amethyst amber install [options]" - echo "" - echo "Arguments:" - echo " The version of amber to install" - echo " Use 'latest' to install the latest version" - echo "" - echo "Options:" - echo " --force, -f Force re-install version." - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst amber install [options]") + echo("") + echo("Arguments:") + echo(" The version of amber to install") + echo(" Use 'latest' to install the latest version") + echo("") + echo("Options:") + echo(" --force, -f Force re-install version.") + echo(" --help, -h Show this help message and exit") exit(code) } diff --git a/src/commands/amber/list.ab b/src/commands/amber/list.ab index e9829ce..da2c4e0 100644 --- a/src/commands/amber/list.ab +++ b/src/commands/amber/list.ab @@ -5,11 +5,11 @@ import { get_amber_tags } from "../../../lib/github.ab" import { get_local_versions } from "../../../lib/amber_manager.ab" fun show_help_and_exit() { - echo "Usage: amethyst amber list [options]" - echo "" - echo "Options:" - echo " --all, -a List all available amber versions" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst amber list [options]") + echo("") + echo("Options:") + echo(" --all, -a List all available amber versions") + echo(" --help, -h Show this help message and exit") exit(0) } @@ -33,7 +33,7 @@ pub fun cmd_amber_list(arguments: [Text]): Null { if not show_remote { info("Listing local amber versions:") for version in local_versions { - echo "- {version}" + echo("- {version}") } exit(0) @@ -44,7 +44,7 @@ pub fun cmd_amber_list(arguments: [Text]): Null { for tag in tags { const is_local = array_contains(local_versions, tag) - echo "- {tag} {is_local then "[installed]" else ""}" + echo("- {tag} {is_local then "[installed]" else ""}") } exit(0) diff --git a/src/commands/amber/uninstall.ab b/src/commands/amber/uninstall.ab index 2ccf296..5485a02 100644 --- a/src/commands/amber/uninstall.ab +++ b/src/commands/amber/uninstall.ab @@ -6,13 +6,13 @@ import { get_amber_tags } from "../../../lib/github.ab" import { get_local_versions, is_available_locally, download, delete_download } from "../../../lib/amber_manager.ab" fun show_help_and_exit(code: Num = 0): Null { - echo "Usage: amethyst amber uninstall [options]" - echo "" - echo "Arguments:" - echo " The version of amber to uninstall" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst amber uninstall [options]") + echo("") + echo("Arguments:") + echo(" The version of amber to uninstall") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(code) } diff --git a/src/commands/amber/use.ab b/src/commands/amber/use.ab index 6eac981..2864ab8 100644 --- a/src/commands/amber/use.ab +++ b/src/commands/amber/use.ab @@ -10,13 +10,13 @@ import { get_amber_tags } from "../../../lib/github.ab" import { get_local_versions, is_available_locally, download, delete_download, set_default } from "../../../lib/amber_manager.ab" fun show_help_and_exit(code: Num = 0) { - echo "Usage: amethyst amber use " - echo "" - echo "Arguments:" - echo " The version of amber to use" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst amber use ") + echo("") + echo("Arguments:") + echo(" The version of amber to use") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(code) } @@ -43,13 +43,13 @@ pub fun cmd_amber_use(arguments: [Text]): Null { if not array_contains(tags, version) { info("Couldn't find version {version}, available versions are:") for tag in tags { - echo "- {tag}" + echo("- {tag}") } exit(1) } - echo "Using {version}" + echo("Using {version}") set_default(version) exit(0) diff --git a/src/commands/deps/add.ab b/src/commands/deps/add.ab index f25a52d..7d0d4b3 100644 --- a/src/commands/deps/add.ab +++ b/src/commands/deps/add.ab @@ -3,10 +3,10 @@ import { require_project } from "../../../lib/project.ab" import { info, fatal } from "../../../lib/utils.ab" fun show_help_and_exit() { - echo "Usage: amethyst add github:user/repo:ref" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst add github:user/repo:ref") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(0) } diff --git a/src/commands/deps/install.ab b/src/commands/deps/install.ab index b0482f2..20befbb 100644 --- a/src/commands/deps/install.ab +++ b/src/commands/deps/install.ab @@ -6,10 +6,10 @@ import { require_project, get_ini_value, list_ini_section_properties } from "../ import { info, fatal } from "../../../lib/utils.ab" fun show_help_and_exit() { - echo "Usage: amethyst install" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst install") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(0) } diff --git a/src/commands/deps/remove.ab b/src/commands/deps/remove.ab index 5133127..5f5e3e5 100644 --- a/src/commands/deps/remove.ab +++ b/src/commands/deps/remove.ab @@ -3,10 +3,10 @@ import { require_project } from "../../../lib/project.ab" import { info, fatal } from "../../../lib/utils.ab" fun show_help_and_exit() { - echo "Usage: amethyst remove repo" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst remove repo") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(0) } diff --git a/src/commands/env.ab b/src/commands/env.ab index b3b1f19..c50cf77 100644 --- a/src/commands/env.ab +++ b/src/commands/env.ab @@ -4,7 +4,7 @@ import { get_amethyst_bin_dir } from "../../lib/environment.ab" pub fun cmd_env(arguments: [Text]): Null { const bin_dir = get_amethyst_bin_dir() - echo "export PATH=\"{bin_dir}:$PATH\"" + echo("export PATH=\"{bin_dir}:$PATH\"") exit(0) } diff --git a/src/commands/init.ab b/src/commands/init.ab index d4814a1..2937ad5 100644 --- a/src/commands/init.ab +++ b/src/commands/init.ab @@ -35,7 +35,7 @@ pub fun cmd_init(arguments: [Text]): Null { // set latest amber version file_write("{dest}/amethyst.ini", join([ "[amethyst]", - "amber-version = 0.5.1-alpha", + "amber-version = 0.6.0-alpha", "", "[project]", @@ -49,7 +49,7 @@ pub fun cmd_init(arguments: [Text]): Null { "#!/bin/env amethyst", "", "main(args) \{", - " echo \"Hello Amber!\"", + " echo(\"Hello Amber!\")", "}" ], "\n")) diff --git a/src/main.ab b/src/main.ab index 95ec77b..89eba49 100755 --- a/src/main.ab +++ b/src/main.ab @@ -32,22 +32,22 @@ if len(missing) > 0 { } fun show_help_and_exit(code: Num = 0) { - echo "Usage: amethyst [options]" - echo "" - echo "Commands:" - echo " init Bootstrap a new amber project" - echo " info Display information about the current amber project" - echo " add Add a dependency to amethyst.ini" - echo " remove Remove a dependency from amethyst.ini" - echo " install Install the dependencies defined in amethyst.ini" - echo " run Run current project" - echo " build Build current project" - echo " env Generate bash env" - echo " amber Manage amber versions" - echo " deps Manage dependencies" - echo "" - echo "Options:" - echo " --help, -h Show this help message and exit" + echo("Usage: amethyst [options]") + echo("") + echo("Commands:") + echo(" init Bootstrap a new amber project") + echo(" info Display information about the current amber project") + echo(" add Add a dependency to amethyst.ini") + echo(" remove Remove a dependency from amethyst.ini") + echo(" install Install the dependencies defined in amethyst.ini") + echo(" run Run current project") + echo(" build Build current project") + echo(" env Generate bash env") + echo(" amber Manage amber versions") + echo(" deps Manage dependencies") + echo("") + echo("Options:") + echo(" --help, -h Show this help message and exit") exit(code) } From bb0998c53210b4cbfceadbe06fb8911408587c3f Mon Sep 17 00:00:00 2001 From: Tirito6626 Date: Thu, 2 Jul 2026 12:53:51 +0000 Subject: [PATCH 2/2] shorted the version --- amethyst.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amethyst.ini b/amethyst.ini index b709d4e..820334c 100644 --- a/amethyst.ini +++ b/amethyst.ini @@ -1,5 +1,5 @@ [amethyst] -amber-version = amber-0.6.0-alpha +amber-version = 0.6.0-alpha [dependencies] xylitol = https://github.com/zlfn/xylitol.git