44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
/*
|
|
* dotfiles - search.ts
|
|
*
|
|
* Created by Janis Hutz 03/22/2025, Licensed under the GPL V3 License
|
|
* https://janishutz.com, development@janishutz.com
|
|
*
|
|
*
|
|
*/
|
|
|
|
import subprocessRunner from "./subprocessRunner";
|
|
|
|
const preprocess = ( input: string ) => {
|
|
// Find out what kind of instruction to process
|
|
if ( input.startsWith( ':' ) ) {
|
|
processCommand( input.substring( 1, input.indexOf( ' ' ) ), input.substring( input.indexOf( ' ' ) ).split( ' ' ) );
|
|
} else if ( input.startsWith( '!' ) ) {
|
|
processBang( input.substring( 1, input.indexOf( ' ' ) ), input.substring( input.indexOf( ' ' ) ) );
|
|
} else {
|
|
// Determine if entered string is calculation or not
|
|
// We can easily do that by asking qalc (qalculate cli) if this is fine
|
|
subprocessRunner.executeCommand( 'qalc "' + input + '"' ).then( out => {
|
|
print( out );
|
|
} ).catch( err => {
|
|
print( err );
|
|
} );
|
|
}
|
|
}
|
|
|
|
const processSearch = ( input: string ) => {
|
|
|
|
}
|
|
|
|
const processCalculation = ( input: string ) => {
|
|
|
|
}
|
|
|
|
const processCommand = ( cmd: string, args: string[] ) => {
|
|
|
|
}
|
|
|
|
const processBang = ( bang: string, input: string ) => {
|
|
|
|
}
|