Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion amethyst.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[amethyst]
amber-version = 0.5.1-alpha
amber-version = 0.6.0-alpha

[dependencies]
xylitol = https://github.com/zlfn/xylitol.git
Expand Down
4 changes: 2 additions & 2 deletions lib/deps/_utils.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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})")
}
}
6 changes: 2 additions & 4 deletions lib/path.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
20 changes: 10 additions & 10 deletions src/commands/amber/_mod.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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 <command> [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 <command> [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)
}

Expand Down
18 changes: 9 additions & 9 deletions src/commands/amber/install.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version> [options]"
echo ""
echo "Arguments:"
echo " <version> 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 <version> [options]")
echo("")
echo("Arguments:")
echo(" <version> 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)
}

Expand Down
14 changes: 7 additions & 7 deletions src/commands/amber/list.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
Expand All @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions src/commands/amber/uninstall.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version> [options]"
echo ""
echo "Arguments:"
echo " <version> The version of amber to uninstall"
echo ""
echo "Options:"
echo " --help, -h Show this help message and exit"
echo("Usage: amethyst amber uninstall <version> [options]")
echo("")
echo("Arguments:")
echo(" <version> The version of amber to uninstall")
echo("")
echo("Options:")
echo(" --help, -h Show this help message and exit")
exit(code)
}

Expand Down
18 changes: 9 additions & 9 deletions src/commands/amber/use.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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 <version>"
echo ""
echo "Arguments:"
echo " <version> The version of amber to use"
echo ""
echo "Options:"
echo " --help, -h Show this help message and exit"
echo("Usage: amethyst amber use <version>")
echo("")
echo("Arguments:")
echo(" <version> The version of amber to use")
echo("")
echo("Options:")
echo(" --help, -h Show this help message and exit")
exit(code)
}

Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions src/commands/deps/add.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions src/commands/deps/install.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions src/commands/deps/remove.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/env.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions src/commands/init.ab
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand All @@ -49,7 +49,7 @@ pub fun cmd_init(arguments: [Text]): Null {
"#!/bin/env amethyst",
"",
"main(args) \{",
" echo \"Hello Amber!\"",
" echo(\"Hello Amber!\")",
"}"
], "\n"))

Expand Down
32 changes: 16 additions & 16 deletions src/main.ab
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ if len(missing) > 0 {
}

fun show_help_and_exit(code: Num = 0) {
echo "Usage: amethyst <command> [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 <command> [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)
}

Expand Down