mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-24 00:01:03 +08:00
Making basic tty execute command.
For testing, use `execute hotnews` :)
This commit is contained in:
parent
a94b6fbb79
commit
5c64018601
@ -13,8 +13,6 @@ const openNewWindow = (windowId: string) => {
|
|||||||
emit("windowopener", windowId);
|
emit("windowopener", windowId);
|
||||||
};
|
};
|
||||||
|
|
||||||
const printAbout = () => {};
|
|
||||||
|
|
||||||
const focusInput = () => {
|
const focusInput = () => {
|
||||||
inputRef.value?.focus();
|
inputRef.value?.focus();
|
||||||
};
|
};
|
||||||
@ -23,6 +21,7 @@ onMounted(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const startScript = () => {
|
const startScript = () => {
|
||||||
|
if (commandInputBox.value) {
|
||||||
console.log(commandInputBox.value);
|
console.log(commandInputBox.value);
|
||||||
const firstWord = commandInputBox.value.replace(/\s+.*$/, "").trim();
|
const firstWord = commandInputBox.value.replace(/\s+.*$/, "").trim();
|
||||||
const app = commands.find((item) => item.command === firstWord);
|
const app = commands.find((item) => item.command === firstWord);
|
||||||
@ -32,12 +31,21 @@ const startScript = () => {
|
|||||||
console.error("Cannot find match");
|
console.error("Cannot find match");
|
||||||
}
|
}
|
||||||
commandInputBox.value = "";
|
commandInputBox.value = "";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const findExecutable = (inputContent: string) => {
|
const findExecutable = (inputContent: string) => {
|
||||||
console.log(inputContent);
|
const executeMatch = inputContent.match(/^execute\s+(.*)$/);
|
||||||
|
if (executeMatch) {
|
||||||
|
const targetPath = executeMatch[1].trim();
|
||||||
|
console.log("Executing:", targetPath);
|
||||||
|
openNewWindow(targetPath);
|
||||||
|
} else {
|
||||||
|
console.error("Invalid execute command format");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const printAbout = () => {};
|
||||||
// scripts
|
// scripts
|
||||||
const commands = [
|
const commands = [
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user