aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2024-03-20 11:11:19 -0400
committerAdam Harrison <adamdharrison@gmail.com>2024-03-20 11:11:19 -0400
commit4d19741c9df760e2c62a848e5ad91143e0c17bab (patch)
tree826730f4bf66421ac141c3b5a9277bcd112f77dd
parent829c8ec06f2c083ebedc1001fa71ff4b6becc9f7 (diff)
downloadlite-xl-plugin-manager-4d19741c9df760e2c62a848e5ad91143e0c17bab.tar.gz
lite-xl-plugin-manager-4d19741c9df760e2c62a848e5ad91143e0c17bab.zip
Added in ability to execute string literals for ease of automation.
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--src/lpm.lua14
2 files changed, 13 insertions, 3 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e5e5998..f946194 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -60,7 +60,7 @@ jobs:
env: { DISCORD_WEBHOOK: "${{ secrets.DISCORD_WEBHOOK }}" }
run: |
if [[ `git tag --points-at HEAD v* | head -c 1` == "v" ]]; then
- perl -e 'use JSON qw(encode_json from_json); $/ = undef; print encode_json({ content => "## Lite XL Plugin Manager $ENV{VERSION} has been released!\nhttps://github.com/lite-xl/lite-xl-plugin-manager/releases/tag/v$ENV{VERSION}\n\n### Changes in $ENV{VERSION}:\n" . <> })' < NOTES.md |
+ perl -e 'use JSON qw(encode_json from_json); $/ = undef; print encode_json({ content => "## Lite XL Plugin Manager $ENV{VERSION} has been released!\nhttps://github.com/lite-xl/lite-xl-plugin-manager/releases/tag/v$ENV{VERSION}\n@release:lpm\n### Changes in $ENV{VERSION}:\n" . <> })' < NOTES.md |
curl -H 'Content-Type:application/json' $DISCORD_WEBHOOK -X POST -d "$(</dev/stdin)"
fi
diff --git a/src/lpm.lua b/src/lpm.lua
index 23747a7..0921ba7 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -2329,7 +2329,7 @@ There exist also other debug commands that are potentially useful, but are
not commonly used publically.
lpm test <test file> Runs the specified test suite.
- lpm exec <file> Runs the specified lua file with the internal
+ lpm exec <file|string> Runs the specified lua file/string with the internal
interpreter.
lpm download <url> [target] Downloads the specified URL to stdout,
or to the specified target file.
@@ -2530,7 +2530,17 @@ not commonly used publically.
local arg = common.slice(ARGS, 4)
arg[0] = ARGS[1]
rawset(_G, "arg", arg)
- loadfile(ARGS[3])(table.unpack(arg))
+ local chunk, err
+ if system.stat(ARGS[3]) then
+ chunk, err = loadfile(ARGS[3])
+ else
+ chunk, err = load(ARGS[3])
+ end
+ if chunk then
+ chunk(table.unpack(arg))
+ else
+ error(err)
+ end
os.exit(0)
end
if ARGS[2] == "download" then