Shortcuts für PlatformIO

This commit is contained in:
rene 2026-01-04 10:02:25 +01:00
parent ab2f2580a8
commit 370f5109b5
6 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# Put files in this folder to add your own custom functionality.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization
#
# Files in the custom/ directory will be:
# - loaded automatically by the init script, in alphabetical order
# - loaded last, after all built-ins in the lib/ directory, to override them
# - ignored by git by default
#
# Example: add custom/shortcuts.zsh for shortcuts to your local projects
#
# brainstormr=~/Projects/development/planetargon/brainstormr
# cd $brainstormr

View file

@ -0,0 +1,54 @@
# PlatformIO Helper-Funktionen
# Findet das PlatformIO-Projektverzeichnis (wo platformio.ini liegt)
_pio_find_root() {
local dir="$PWD"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/platformio.ini" ]]; then
echo "$dir"
return 0
fi
dir="$(dirname "$dir")"
done
echo "Fehler: Kein PlatformIO-Projekt gefunden (platformio.ini fehlt)" >&2
return 1
}
# Build
alias piob='_pio_build'
_pio_build() {
local root=$(_pio_find_root) || return 1
echo "Building in: $root"
(cd "$root" && pio run)
}
# Upload
alias piou='_pio_upload'
_pio_upload() {
local root=$(_pio_find_root) || return 1
echo "Uploading from: $root"
(cd "$root" && pio run --target upload)
}
# Monitor
alias piom='_pio_monitor'
_pio_monitor() {
local root=$(_pio_find_root) || return 1
echo "Starting monitor from: $root"
(cd "$root" && pio device monitor)
}
# Upload + Monitor (praktische Kombi)
alias pioum='_pio_upload_monitor'
_pio_upload_monitor() {
local root=$(_pio_find_root) || return 1
echo "Upload & Monitor from: $root"
(cd "$root" && pio run --target upload && pio device monitor)
}
# Clean
alias pioc='_pio_clean'
_pio_clean() {
local root=$(_pio_find_root) || return 1
echo "Cleaning: $root"
(cd "$root" && pio run --target clean)
}

View file

@ -0,0 +1,3 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-plugins

@ -0,0 +1 @@
Subproject commit 5eb677bb0fa9a3e60f0eff031dc13926e093df92

View file

@ -0,0 +1,6 @@
# Put your custom themes in this folder.
# See: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes
#
# Example:
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg[yellow]%}%~ %{$reset_color%}%% "

@ -0,0 +1 @@
Subproject commit 36f3045d69d1ba402db09d09eb12b42eebe0fa3b