save point

This commit is contained in:
kake26 2025-05-12 14:35:28 -05:00
parent 4c8b2b9c3b
commit 5b83c89d4a
Signed by: kake26
GPG key ID: E0A989B571D1F99F
9 changed files with 128 additions and 41 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Paul Malcher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -1,3 +1,5 @@
{ {
"bashini": "new" "lactozora": {
"version": "0.0.1"
}
} }

View file

@ -19,29 +19,12 @@ cleanup() {
} }
source ./modules/config_json.bash # can be json or ini, I preffer json source ./modules/config_json.bash # can be json or ini, I preffer json
#source ./modules/gui.bash source ./modules/init_project.bash
#source ./modules/ntfy.bash version=$(read_json "$JSON_FILE" "lactozora" "version")
#source ./modules/keydb.bash echo "Lactozora version: $version"
source ./modules/tmux.bash #
# Keydb / Redis interaction functions, works for both if [ -n "$1" ]; then
init_project "$1"
else
# show_notification "Hello World!" echo "The lactozora bash framework. Feed this script a project directory to initialize it. That is all this script does."
fi
# send_ntfy_message "Hello World!" "kuma"
# Get list of panes
# We check how many windows
windows=$(tmux_list_windows)
echo "Windows"
echo "$windows"
# We check how many panes
panes=$(tmux_list_panes)
echo "Panes"
echo "$panes"

View file

@ -1,7 +0,0 @@
[section]
key=newvalue
key2=fuck this
[newsection]
key=newvalue

View file

@ -1,6 +0,0 @@
{
"bashini": "new",
"section": {
"key": "beer"
}
}

33
modules/filen.bash Normal file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
# Filen module for lactozora framework
# Requires filen-cli to be installed and authenticated
filen_upload() {
local file_path="$1"
local remote_path="$2"
if [[ ! -f "$file_path" ]]; then
echo "Error: File $file_path does not exist" >&2
return 1
fi
if ! command -v filen &> /dev/null; then
echo "Error: filen-cli is not installed" >&2
return 1
fi
filen upload "$file_path" "$remote_path"
}
filen_download() {
local remote_path="$1"
local local_path="$2"
if ! command -v filen &> /dev/null; then
echo "Error: filen-cli is not installed" >&2
return 1
fi
filen download "$remote_path" "$local_path"
}

21
modules/header.bash Normal file
View file

@ -0,0 +1,21 @@
#!/bin/bash
# this is the main script template
set -eo pipefail #these can cause problems when you want stuff to keep going
if [[ -n "${BASHD_DEBUG}" ]]; then # a inevitability that this will be used
set -x
fi
trap cleanup EXIT # A little more robust cleanup
# trap errors and set the ERR trap
trap 'echo -e "\nERROR: $BASH_COMMAND\nFILE: ${BASH_SOURCE[0]}\nLINE: ${BASH_LINENO[0]}\n" >&2; exit 1' ERR
cleanup() {
# We can clean up any temp files or what nots, but for now a place holder
true
}
source ./modules/config_json.bash

39
modules/init_project.bash Normal file
View file

@ -0,0 +1,39 @@
#!/bin/bash
# Function to initialize a new project
init_project() {
if [ -z "$1" ]; then
echo "Usage: init_project <project_name>"
return 1
fi
PROJECT_NAME=$1
PROJECT_DIR="${PWD}/${PROJECT_NAME}"
# Create project directory structure
mkdir -p "${PROJECT_DIR}"/{src,modules,tests,docs}
# Create basic files
touch "${PROJECT_DIR}"/README.md
touch "${PROJECT_DIR}"/main.bash
chmod +x "${PROJECT_DIR}"/main.bash
cp -r modules "${PROJECT_DIR}"
# Populate README with basic content
echo "# ${PROJECT_NAME}" >> "${PROJECT_DIR}"/README.md
echo "" >> "${PROJECT_DIR}"/README.md
echo "This is a new project created using the lactozora framework." >> "${PROJECT_DIR}"/README.md
# Add basic template to main.bash
echo "#!/bin/bash" >> "${PROJECT_DIR}"/main.bash
echo "" >> "${PROJECT_DIR}"/main.bash
echo "# Main script for ${PROJECT_NAME}" >> "${PROJECT_DIR}"/main.bash
echo "source ./modules/header.bash" >> "${PROJECT_DIR}"/main.bash
echo "" >> "${PROJECT_DIR}"/main.bash
echo "# Add your code here" >> "${PROJECT_DIR}"/main.bash
echo "" >> "${PROJECT_DIR}"/main.bash
echo "# End of main script" >> "${PROJECT_DIR}"/main.bash
echo "" >> "${PROJECT_DIR}"/main.bash
echo "Project '${PROJECT_NAME}' initialized successfully in ${PROJECT_DIR}"
}

View file

@ -18,7 +18,8 @@ tmux_capture_pane() {
# List all available tmux panes # List all available tmux panes
tmux_list_panes() { tmux_list_panes() {
tmux list-panes -F "#{window_id} #{pane_id} #{pane_title} #{pane_current_command}" #tmux list-panes -F "#{window_id} #{pane_id} #{pane_title} #{pane_current_command}"
tmux list-panes -a -F "#{session_name}:#{window_index}.#{pane_index} - #{pane_current_command}"
} }
tmux_list_windows() { tmux_list_windows() {