From 499b7cdef5d62298c17889895a61a110d7cd8168 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 3 Jul 2024 16:18:32 +0800 Subject: feat: rename `may_execute_*` to `execute_*` (#56) --- tools/execute_command.sh | 11 +++++++++++ tools/execute_js_code.js | 9 +++++++++ tools/execute_py_code.py | 6 ++++++ tools/may_execute_command.sh | 11 ----------- tools/may_execute_js_code.js | 9 --------- tools/may_execute_py_code.py | 6 ------ 6 files changed, 26 insertions(+), 26 deletions(-) create mode 100755 tools/execute_command.sh create mode 100644 tools/execute_js_code.js create mode 100644 tools/execute_py_code.py delete mode 100755 tools/may_execute_command.sh delete mode 100644 tools/may_execute_js_code.js delete mode 100644 tools/may_execute_py_code.py (limited to 'tools') diff --git a/tools/execute_command.sh b/tools/execute_command.sh new file mode 100755 index 0000000..6acc021 --- /dev/null +++ b/tools/execute_command.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +set -e + +# @describe Runs a shell command. +# @option --command! The command to execute. + +main() { + eval "$argc_command" +} + +eval "$(argc --argc-eval "$0" "$@")" \ No newline at end of file diff --git a/tools/execute_js_code.js b/tools/execute_js_code.js new file mode 100644 index 0000000..4706e07 --- /dev/null +++ b/tools/execute_js_code.js @@ -0,0 +1,9 @@ +/** + * Runs the javascript code in node.js. + * @typedef {Object} Args + * @property {string} code - Javascript code to execute, such as `console.log("hello world")` + * @param {Args} args + */ +exports.run = function run({ code }) { + eval(code); +} diff --git a/tools/execute_py_code.py b/tools/execute_py_code.py new file mode 100644 index 0000000..5f6af2f --- /dev/null +++ b/tools/execute_py_code.py @@ -0,0 +1,6 @@ +def run(code: str): + """Runs the python code. + Args: + code: Python code to execute, such as `print("hello world")` + """ + exec(code) diff --git a/tools/may_execute_command.sh b/tools/may_execute_command.sh deleted file mode 100755 index 6acc021..0000000 --- a/tools/may_execute_command.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -set -e - -# @describe Runs a shell command. -# @option --command! The command to execute. - -main() { - eval "$argc_command" -} - -eval "$(argc --argc-eval "$0" "$@")" \ No newline at end of file diff --git a/tools/may_execute_js_code.js b/tools/may_execute_js_code.js deleted file mode 100644 index 4706e07..0000000 --- a/tools/may_execute_js_code.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Runs the javascript code in node.js. - * @typedef {Object} Args - * @property {string} code - Javascript code to execute, such as `console.log("hello world")` - * @param {Args} args - */ -exports.run = function run({ code }) { - eval(code); -} diff --git a/tools/may_execute_py_code.py b/tools/may_execute_py_code.py deleted file mode 100644 index 5f6af2f..0000000 --- a/tools/may_execute_py_code.py +++ /dev/null @@ -1,6 +0,0 @@ -def run(code: str): - """Runs the python code. - Args: - code: Python code to execute, such as `print("hello world")` - """ - exec(code) -- cgit v1.2.3