diff --git a/src/classes/sys/sys.class b/src/classes/sys/sys.class index 556dc78..8625cb9 100644 --- a/src/classes/sys/sys.class +++ b/src/classes/sys/sys.class @@ -433,18 +433,28 @@ sys.util.trim() { echo "$1" | xargs } +sys.dependencies.installed() { + if [ $(which "$1") != "" ]; then + # echo "yes" + return 0 + else + # echo "no" + return 1 + fi +} + sys.dependencies.install() { if sys.os.mac; then sys.log.info "Installing dependencies for macOS..." brew update - brew install xclip jq csvkit lynx + brew install xclip jq csvkit lynx tmux brew tap teamookla/speedtest brew install speedtest --force pip3 install -r "${WYX_DIR}/requirements.txt" elif sys.os.linux; then sys.log.info "Installing dependencies for Linux..." sudo apt-get update - sudo apt-get -y install xclip jq csvkit lynx + sudo apt-get -y install xclip jq csvkit lynx tmux curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash sudo apt-get -y install speedtest pip3 install -r "${WYX_DIR}/requirements.txt" diff --git a/src/commands/multiplex.sh b/src/commands/multiplex.sh new file mode 100644 index 0000000..41a10f7 --- /dev/null +++ b/src/commands/multiplex.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Check if tmux is installed +if ! sys.dependencies.installed "tmux"; then + echo "You need to install tmux to use this command." + exit 1 +fi + +# Check if at least one command is provided +if [ "$#" -lt 1 ]; then + echo "You need to provide at least one command." + exit 1 +fi + +# Create a new tmux session named "my_session" +SESSION="my_session" +tmux new-session -d -s $SESSION + +# Create the first window and run the first command +tmux send-keys "$1" C-m + +# Create additional panes for each command +for i in $(seq 2 $#); do + tmux split-window -t $SESSION -h + tmux select-layout -t $SESSION tiled + tmux send-keys "${!i}" C-m +done + +# Adjust the layout to tiled +tmux select-layout -t $SESSION tiled + +# Attach to the tmux session +tmux attach-session -t $SESSION diff --git a/src/data/arg_scripts.csv b/src/data/arg_scripts.csv index 7daa372..0fa8c2c 100644 --- a/src/data/arg_scripts.csv +++ b/src/data/arg_scripts.csv @@ -65,4 +65,5 @@ list-deps,list-deps,"List the project dependencies",true,,deps update-readme,update_readme,"Auto-update the project's readme with the available commands",false,, update-cache,update_cache,"Auto-update the project's cache with the available commands",false,, pp,pp,"Pull-Push Git Changes to Current Branch",true,,git -port-scan,port-scan,"Scan for open ports on a host",true, ,nutil \ No newline at end of file +port-scan,port-scan,"Scan for open ports on a host",true, ,nutil +multiplex,multiplex,"Create a multiplexed window terminal running multiple commands.", ...,code