Add script functionality

This commit is contained in:
2025-10-28 20:14:32 +01:00
parent b1a6654d1c
commit 48ab557769
5 changed files with 127 additions and 0 deletions

25
scripts/hxi Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/zsh
# Runs the IDE
SESSIONID="IDE-${RANDOM}"
TMUX=$(where tmux)
# Set editor to helix, if unset
if [ -z ${EDITOR+x} ]; then
EDITOR=$(where hx)
fi
# Open a new session with a random name
$TMUX new-session -d -s $SESSINID $EDITOR
$TMUX rename-window -t ${SESSIONID}:0 "TMUX IDE"
# check, if a layout file is present, and run it.
if [ -f ./.tmux.layout ]; then
source ./.tmux.layout
fi
# Finally, select the editor window in the current session,
# and attach to the session
$TMUX select-window -t ${SESSIONID}:0
$TMUX select-pane -t 0
$TMUX attach-session -t ${SESSIONID}

3
scripts/install.sh Normal file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
mkdir -p ~/.local/bin
cp ~/.config/tmux/scripts/hxi ~/.local/bin

71
scripts/makescript.sh Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/zsh
# configure make tools
WAF=$(where waf)
CARGO=$(where cargo)
CMAKE=$(where cmake)
MAKE=$(where make)
WAITMSG="Press any key to continue..."
function find-up() {
curpath=$(pwd)
while [[ "$curpath" != "" && ! -e "$curpath/$1" ]]; do
curpath=${curpath%/*}
done
echo $curpath
}
function wait-for-keypress() {
echo $WAITMSG
read -k
}
# look for the make file for waf
MAKEPATH=$(find-up "wscript")
if [[ "$MAKEPATH" != "" ]]
then
echo "Found 'wscript' file. Building WAF project."
cd $MAKEPATH
$WAF configure build
wait-for-keypress
return 0
fi
# look for a cargo file for rust.
MAKEPATH=$(find-up "Cargo.toml")
if [[ "$MAKEPATH" != "" ]]
then
echo "Found 'Cargo.toml' file. Building rust project."
cd $MAKEPATH
$CARGO build
wait-for-keypress
return 0
fi
# look for a make file for CMAKE
MAKEPATH=$(find-up "CMakeList.txt")
if [[ "$MAKEPATH" != "" ]]
then
echo "Found 'CMakeList.txt' file. Building CMAKE project."
cd $MAKEPATH
$CMAKE -DCMAKE_BUILD_TYPE=Debug -S . -B ./build
$CMAKE --build ./build
wait-for-keypress
return 0
fi
# look for a classical make file
MAKEPATH=$(find-up "Makefile")
if [[ "$MAKEPATH" != "" ]]
then
cd $MAKEPATH
./configure
$MAKE
wait-for-keypress
return 0
fi
echo "No matching makefiles found"
wait-for-keypress
return 1