From e430bdf89f3fd63c9ab504fa6c660352b9913a4c Mon Sep 17 00:00:00 2001 From: daimond113 <72147841+daimond113@users.noreply.github.com> Date: Sat, 12 Oct 2024 19:14:47 +0200 Subject: [PATCH] feat: inform user about not finding any bin package when invoking from bin --- CHANGELOG.md | 3 +++ src/cli/commands/install.rs | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c35f5..030a7d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added +- Inform user about not finding any bin package when using its bin invocation by @daimond113 + ### Fixed - Fix `self-upgrade` overwriting its own binary by @daimond113 - Allow use of Luau packages in `execute` command by @daimond113 diff --git a/src/cli/commands/install.rs b/src/cli/commands/install.rs index 32ccdef..5861793 100644 --- a/src/cli/commands/install.rs +++ b/src/cli/commands/install.rs @@ -51,6 +51,7 @@ fn bin_link_file(alias: &str) -> String { format!( r#"{prefix}local process = require("@lune/process") local fs = require("@lune/fs") +local stdio = require("@lune/stdio") local project_root = process.cwd local path_components = string.split(string.gsub(project_root, "\\", "/"), "/") @@ -68,9 +69,11 @@ for _, packages_folder in {{ {all_folders} }} do if fs.isFile(path) then require(path) - break + return end end + +stdio.ewrite(stdio.color("red") .. "binary `{alias}` not found. are you in the right directory?" .. stdio.color("reset") .. "\n") "#, ) }