Restructure, prepare launcher
This commit is contained in:
10
config/ags/launcher/util/file.ts
Normal file
10
config/ags/launcher/util/file.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* dotfiles - file.ts
|
||||
*
|
||||
* Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { readFileAsync, writeFileAsync, monitorFile } from "astal";
|
0
config/ags/launcher/util/fzf.ts
Normal file
0
config/ags/launcher/util/fzf.ts
Normal file
0
config/ags/launcher/util/search.ts
Normal file
0
config/ags/launcher/util/search.ts
Normal file
43
config/ags/launcher/util/subprocessRunner.ts
Normal file
43
config/ags/launcher/util/subprocessRunner.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* dotfiles - subprocessRunner.ts
|
||||
*
|
||||
* Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License
|
||||
* https://janishutz.com, development@janishutz.com
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
import { subprocess, execAsync, Process } from "astal/process";
|
||||
|
||||
// TODO: Get cwd and the likes to then use that to run JavaScript files with node / python with python, etc
|
||||
|
||||
/**
|
||||
* Run a subprocess. If you simply want to run a command that doesn't need continuous updates
|
||||
* run executeCommand instead.
|
||||
* @param cmd - The command to be run
|
||||
* @param onOut - Calback function for stdout of the subprocess
|
||||
* @param onErr - [TODO:description]
|
||||
* @returns [TODO:return]
|
||||
*/
|
||||
const startSubProcess = (
|
||||
cmd: string | string[],
|
||||
onOut: (stdout: string) => void,
|
||||
onErr: (stderr: string) => void | undefined,
|
||||
): Process => {
|
||||
return subprocess( cmd, onOut, onErr );
|
||||
};
|
||||
|
||||
/**
|
||||
* Run a command. If you need continuous updates, run startSubProcess instead
|
||||
* @param cmd - The command to be run. Either a string or an array of strings
|
||||
* @returns A Promise resolving to stdout of the command
|
||||
*/
|
||||
const executeCommand = (cmd: string | string[]): Promise<string> => {
|
||||
return execAsync( cmd );
|
||||
};
|
||||
|
||||
|
||||
export default {
|
||||
startSubProcess,
|
||||
executeCommand
|
||||
}
|
Reference in New Issue
Block a user