[ADDED] Soporte para glow (Charm Markdown renderer)
- Añadida función para instalar Glow (renderizador de Markdown) - Integrado en bootstrap.sh para instalación automática - Actualizado README.md para reflejar nueva herramienta - Usa repositorios oficiales de Charm cuando están disponibles - Alternativa con instalación de binarios para sistemas sin repo oficial 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
70bfb3f064
commit
3ac43ff7a0
3 changed files with 81 additions and 1 deletions
|
@ -63,7 +63,7 @@ MRDevs Tools utiliza una estructura organizada que separa el código (en ~/devs)
|
|||
|
||||
| Comando | Descripción |
|
||||
|---------|-------------|
|
||||
| `bin/bootstrap.sh` | Instala herramientas básicas (incluyendo oathtool, zbar, redis-cli y gum) y configura la gestión de contenedores |
|
||||
| `bin/bootstrap.sh` | Instala herramientas básicas (incluyendo oathtool, zbar, redis-cli, gum y glow) y configura la gestión de contenedores |
|
||||
| `bin/update.sh` | Actualiza el entorno de desarrollo y herramientas (incluyendo oathtool, zbar, redis-cli y gum) |
|
||||
| `bin/npm_install.sh` | Instala NodeJS y npm de forma interactiva |
|
||||
| `bin/project_new.sh` | Crea un nuevo proyecto con estructura estandarizada según el tipo seleccionado |
|
||||
|
|
|
@ -90,6 +90,7 @@ install() {
|
|||
local ZBAR_PACKAGE=zbar
|
||||
local REDIS_CLI_PACKAGE=redis-tools
|
||||
local GUM_PACKAGE=gum
|
||||
local GLOW_PACKAGE=glow
|
||||
|
||||
# Load base bash library
|
||||
BIN_HOME=$BIN_PATH
|
||||
|
@ -239,6 +240,14 @@ install() {
|
|||
echo "Instalando gum..."
|
||||
gum_install
|
||||
fi
|
||||
|
||||
# Install glow if not already installed
|
||||
command_installed glow
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Instalando glow..."
|
||||
glow_install
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -513,3 +513,74 @@ gpgkey=https://repo.charm.sh/yum/gpg.key' | tee /etc/yum.repos.d/charm.repo
|
|||
echo "gum instalado correctamente."
|
||||
return 0
|
||||
}
|
||||
|
||||
# Install glow package (Markdown renderer)
|
||||
function glow_install() {
|
||||
echo "Instalando glow (renderizador de Markdown para terminal)..."
|
||||
|
||||
if [ "$(uname)" == "Darwin" ]; then
|
||||
# En macOS, instalamos a través de Homebrew
|
||||
brew install glow
|
||||
elif [ -f /etc/debian_version ] || [ -f /etc/os-release ]; then
|
||||
# En sistemas Debian y derivados
|
||||
mkdir -p /etc/apt/keyrings
|
||||
curl -fsSL https://repo.charm.sh/apt/gpg.key | gpg --dearmor -o /etc/apt/keyrings/charm.gpg
|
||||
echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" > /etc/apt/sources.list.d/charm.list
|
||||
apt update
|
||||
apt install -y glow
|
||||
elif [ -f /etc/redhat-release ]; then
|
||||
# En sistemas Red Hat
|
||||
echo '[charm]
|
||||
name=Charm
|
||||
baseurl=https://repo.charm.sh/yum/
|
||||
enabled=1
|
||||
gpgcheck=1
|
||||
gpgkey=https://repo.charm.sh/yum/gpg.key' | tee /etc/yum.repos.d/charm.repo
|
||||
dnf install -y glow
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
# En Arch Linux, instalamos desde AUR
|
||||
command_installed "yay"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Instalando yay para acceder a AUR..."
|
||||
pacman -Sy --noconfirm git base-devel
|
||||
git clone https://aur.archlinux.org/yay.git /tmp/yay
|
||||
cd /tmp/yay
|
||||
makepkg -si --noconfirm
|
||||
cd - > /dev/null
|
||||
rm -rf /tmp/yay
|
||||
fi
|
||||
yay -S --noconfirm glow
|
||||
elif [ -f /etc/rc.conf ]; then
|
||||
# En FreeBSD
|
||||
pkg install -y glow
|
||||
else
|
||||
# Para otros sistemas, descargamos el binario precompilado
|
||||
local arch=$(uname -m)
|
||||
local os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
local latest_version=$(curl -s https://api.github.com/repos/charmbracelet/glow/releases/latest | grep -oP '"tag_name": "\K[^"]+')
|
||||
|
||||
# Convertir arquitectura para compatibilidad con las versiones de GitHub
|
||||
case $arch in
|
||||
x86_64) arch="amd64" ;;
|
||||
aarch64|arm64) arch="arm64" ;;
|
||||
armv7*) arch="armv7" ;;
|
||||
esac
|
||||
|
||||
# Descargar el binario adecuado
|
||||
local download_url="https://github.com/charmbracelet/glow/releases/download/${latest_version}/glow_${latest_version#v}_${os}_${arch}.tar.gz"
|
||||
cd /tmp
|
||||
curl -Lo glow.tar.gz "$download_url"
|
||||
tar xzf glow.tar.gz
|
||||
mv glow /usr/local/bin/
|
||||
chmod +x /usr/local/bin/glow
|
||||
rm -f glow.tar.gz
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error al instalar glow."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "glow instalado correctamente."
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue