packagin things
- SHA
a9e28cc39d15d45fcb6de12635a7aabe6cd868d7- Parents
-
83f67c6 - Tree
a6b975e
a9e28cc
a9e28cc39d15d45fcb6de12635a7aabe6cd868d783f67c6
a6b975e| Status | File | + | - |
|---|---|---|---|
| A |
fortress.fish
|
38 | 0 |
| A |
fortress.install
|
30 | 0 |
| A |
fortress.sh
|
44 | 0 |
fortress.fishadded@@ -0,0 +1,38 @@ | ||
| 1 | +# FORTRESS shell integration for Fish | |
| 2 | +# This file should be placed in: | |
| 3 | +# ~/.config/fish/functions/fortress.fish | |
| 4 | +# or | |
| 5 | +# /usr/share/fish/vendor_functions.d/fortress.fish (system-wide) | |
| 6 | + | |
| 7 | +function fortress --description "Navigate filesystem with FORTRESS and cd on exit" | |
| 8 | + # Set fortress directory - prefer system install, fallback to FORTRESS_DIR env var | |
| 9 | + set -l fortress_dir | |
| 10 | + if set -q FORTRESS_DIR | |
| 11 | + set fortress_dir $FORTRESS_DIR | |
| 12 | + else if test -x /usr/bin/fortress-bin | |
| 13 | + # Use system-installed binary | |
| 14 | + set fortress_exe /usr/bin/fortress-bin | |
| 15 | + else | |
| 16 | + # Fallback to local development path | |
| 17 | + set fortress_dir $HOME/Documents/GithubOrgs/FortranGoingOnForty/fortress | |
| 18 | + set fortress_exe $fortress_dir/build/gfortran_*/app/fortress | |
| 19 | + end | |
| 20 | + | |
| 21 | + # Run fortress | |
| 22 | + if test -n "$fortress_exe" | |
| 23 | + eval $fortress_exe | |
| 24 | + else | |
| 25 | + $fortress_dir/build/gfortran_*/app/fortress | |
| 26 | + end | |
| 27 | + | |
| 28 | + # Check if fortress wants us to cd somewhere | |
| 29 | + if test -f $HOME/.fortress_cd | |
| 30 | + set -l target_dir (cat $HOME/.fortress_cd) | |
| 31 | + rm -f $HOME/.fortress_cd | |
| 32 | + if cd $target_dir 2>/dev/null | |
| 33 | + echo "fortress: changed directory to "(pwd) | |
| 34 | + else | |
| 35 | + echo "fortress: failed to change directory to $target_dir" >&2 | |
| 36 | + end | |
| 37 | + end | |
| 38 | +end | |
fortress.installadded@@ -0,0 +1,30 @@ | ||
| 1 | +post_install() { | |
| 2 | + echo "" | |
| 3 | + echo "====================================================================" | |
| 4 | + echo " FORTRESS - Terminal File Explorer" | |
| 5 | + echo "====================================================================" | |
| 6 | + echo "" | |
| 7 | + echo " The 'fortress' command is now available!" | |
| 8 | + echo "" | |
| 9 | + echo " Shell integration (cd-on-exit) has been installed:" | |
| 10 | + echo " • Bash: Auto-loaded via /etc/profile.d/fortress.sh" | |
| 11 | + echo " • Fish: Auto-loaded via vendor_functions.d" | |
| 12 | + echo " • Zsh: Add to ~/.zshrc:" | |
| 13 | + echo " source /usr/share/fortress/fortress.sh" | |
| 14 | + echo "" | |
| 15 | + echo " You may need to restart your shell or run:" | |
| 16 | + echo " source /etc/profile.d/fortress.sh # bash" | |
| 17 | + echo "" | |
| 18 | + echo " Usage:" | |
| 19 | + echo " fortress - Start the file explorer" | |
| 20 | + echo " Press 'c' on a directory to cd there and exit" | |
| 21 | + echo "" | |
| 22 | + echo " Documentation: /usr/share/doc/fortress/" | |
| 23 | + echo "" | |
| 24 | + echo "====================================================================" | |
| 25 | + echo "" | |
| 26 | +} | |
| 27 | + | |
| 28 | +post_upgrade() { | |
| 29 | + post_install | |
| 30 | +} | |
fortress.shadded@@ -0,0 +1,44 @@ | ||
| 1 | +# FORTRESS shell integration | |
| 2 | +# Add this to your .bashrc or .zshrc: | |
| 3 | +# source ~/Documents/GithubOrgs/FortranGoingOnForty/fortress/fortress.sh | |
| 4 | +# | |
| 5 | +# Then use: fortress | |
| 6 | + | |
| 7 | +fortress() { | |
| 8 | + # Determine which fortress binary to use | |
| 9 | + local fortress_exe | |
| 10 | + | |
| 11 | + if [ -x "/usr/bin/fortress-bin" ]; then | |
| 12 | + # Use system-installed binary (via package manager) | |
| 13 | + fortress_exe="/usr/bin/fortress-bin" | |
| 14 | + elif [ -n "$FORTRESS_DIR" ]; then | |
| 15 | + # Use FORTRESS_DIR if set | |
| 16 | + fortress_exe="$FORTRESS_DIR/build/gfortran_"*"/app/fortress" | |
| 17 | + else | |
| 18 | + # Fallback to local development path | |
| 19 | + fortress_exe="$HOME/Documents/GithubOrgs/FortranGoingOnForty/fortress/build/gfortran_"*"/app/fortress" | |
| 20 | + fi | |
| 21 | + | |
| 22 | + # Run fortress | |
| 23 | + $fortress_exe | |
| 24 | + | |
| 25 | + # Check if fortress wants us to cd somewhere | |
| 26 | + if [ -f "$HOME/.fortress_cd" ]; then | |
| 27 | + local target_dir | |
| 28 | + target_dir=$(cat "$HOME/.fortress_cd") | |
| 29 | + rm -f "$HOME/.fortress_cd" | |
| 30 | + cd "$target_dir" || return 1 | |
| 31 | + echo "fortress: changed directory to $(pwd)" | |
| 32 | + fi | |
| 33 | +} | |
| 34 | + | |
| 35 | +# For zsh compatibility | |
| 36 | +if [ -n "$ZSH_VERSION" ]; then | |
| 37 | + # Nothing special needed for zsh | |
| 38 | + : | |
| 39 | +fi | |
| 40 | + | |
| 41 | +# Export for subshells if needed (bash only) | |
| 42 | +if [ -n "$BASH_VERSION" ]; then | |
| 43 | + export -f fortress 2>/dev/null || true | |
| 44 | +fi | |