feat: install.sh — touche c pour copier la liste dans le presse-papier
Ajoute un copy_script qui génère la liste visible (champs cachés et codes ANSI supprimés) et la copie via wl-copy (Wayland), xclip ou xsel en fallback. Légende et aide F1 mises à jour. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+24
-2
@@ -420,6 +420,7 @@ run_menu() {
|
|||||||
local list_script="/tmp/skills_list_$$.sh"
|
local list_script="/tmp/skills_list_$$.sh"
|
||||||
local fns_file="/tmp/skills_fns_$$.sh"
|
local fns_file="/tmp/skills_fns_$$.sh"
|
||||||
local preview_script="/tmp/skills_preview_$$.sh"
|
local preview_script="/tmp/skills_preview_$$.sh"
|
||||||
|
local copy_script="/tmp/skills_copy_$$.sh"
|
||||||
|
|
||||||
# Exporter fonctions et données dans un fichier source partagé
|
# Exporter fonctions et données dans un fichier source partagé
|
||||||
{
|
{
|
||||||
@@ -581,6 +582,25 @@ PREVIEW_EOF
|
|||||||
sed -i "s|FNSFILE|$fns_file|" "$preview_script"
|
sed -i "s|FNSFILE|$fns_file|" "$preview_script"
|
||||||
chmod +x "$preview_script"
|
chmod +x "$preview_script"
|
||||||
|
|
||||||
|
# Script de copie presse-papier (touche c)
|
||||||
|
cat > "$copy_script" << 'COPY_EOF'
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
list_script="LISTFILE"
|
||||||
|
# Génère la liste, supprime le champ caché (avant le 1er tab) et les codes ANSI
|
||||||
|
content=$(bash "$list_script" | sed 's/^[^\t]*\t//' | sed 's/\x1b\[[0-9;]*[mGKHF]//g')
|
||||||
|
if command -v wl-copy &>/dev/null; then
|
||||||
|
printf '%s' "$content" | wl-copy
|
||||||
|
elif command -v xclip &>/dev/null; then
|
||||||
|
printf '%s' "$content" | xclip -selection clipboard
|
||||||
|
elif command -v xsel &>/dev/null; then
|
||||||
|
printf '%s' "$content" | xsel --clipboard --input
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
COPY_EOF
|
||||||
|
sed -i "s|LISTFILE|$list_script|" "$copy_script"
|
||||||
|
chmod +x "$copy_script"
|
||||||
|
|
||||||
# Fichier d'aide F1
|
# Fichier d'aide F1
|
||||||
local help_file="/tmp/skills_help_$$.txt"
|
local help_file="/tmp/skills_help_$$.txt"
|
||||||
cat > "$help_file" << HELP_EOF
|
cat > "$help_file" << HELP_EOF
|
||||||
@@ -611,6 +631,7 @@ $(echo -e "${GRV_BLUE}RACCOURCIS CLAVIER${RESET}")
|
|||||||
$(echo -e "${GRV_GREEN}SPACE${RESET}") Changer l'action du skill sélectionné
|
$(echo -e "${GRV_GREEN}SPACE${RESET}") Changer l'action du skill sélectionné
|
||||||
$(echo -e "${GRV_GREEN}TAB${RESET}") Plier / déplier la catégorie
|
$(echo -e "${GRV_GREEN}TAB${RESET}") Plier / déplier la catégorie
|
||||||
$(echo -e "${GRV_GREEN}v${RESET}") Afficher / masquer le contenu du skill (preview)
|
$(echo -e "${GRV_GREEN}v${RESET}") Afficher / masquer le contenu du skill (preview)
|
||||||
|
$(echo -e "${GRV_GREEN}c${RESET}") Copier la liste affichée dans le presse-papier
|
||||||
$(echo -e "${GRV_GREEN}F1${RESET}") Afficher / fermer cette aide
|
$(echo -e "${GRV_GREEN}F1${RESET}") Afficher / fermer cette aide
|
||||||
|
|
||||||
$(echo -e "${GRV_BLUE}ARBRE DES CATÉGORIES${RESET}")
|
$(echo -e "${GRV_BLUE}ARBRE DES CATÉGORIES${RESET}")
|
||||||
@@ -630,7 +651,7 @@ $(echo -e "${GRV_GRAY}Dépôt : https://gitea.maison43.duckdns.org/gilles/mes_sk
|
|||||||
HELP_EOF
|
HELP_EOF
|
||||||
|
|
||||||
local legend
|
local legend
|
||||||
legend=$(echo -e "${GRV_GRAY}État: ${GRV_GREEN}✓ ${GRV_YELLOW}↑ ${GRV_AQUA}+ Action: ${GRV_GREEN}●L ${GRV_BLUE}●G ${GRV_GRAY}○ SPACE=action TAB=plier v=voir F1=aide ENTER=ok ESC=quitter${RESET}")
|
legend=$(echo -e "${GRV_GRAY}État: ${GRV_GREEN}✓ ${GRV_YELLOW}↑ ${GRV_AQUA}+ Action: ${GRV_GREEN}●L ${GRV_BLUE}●G ${GRV_GRAY}○ SPACE=action TAB=plier v=voir c=copier F1=aide ENTER=ok ESC=quitter${RESET}")
|
||||||
|
|
||||||
fzf \
|
fzf \
|
||||||
--ansi \
|
--ansi \
|
||||||
@@ -644,10 +665,11 @@ HELP_EOF
|
|||||||
--bind="space:execute-silent(bash $space_script {1})+reload(bash $list_script)+pos({n})" \
|
--bind="space:execute-silent(bash $space_script {1})+reload(bash $list_script)+pos({n})" \
|
||||||
--bind="tab:execute-silent(bash $tab_script {1})+reload(bash $list_script)" \
|
--bind="tab:execute-silent(bash $tab_script {1})+reload(bash $list_script)" \
|
||||||
--bind="v:toggle-preview" \
|
--bind="v:toggle-preview" \
|
||||||
|
--bind="c:execute-silent(bash $copy_script)" \
|
||||||
--bind="f1:execute(less -R $help_file)" \
|
--bind="f1:execute(less -R $help_file)" \
|
||||||
< <(bash "$list_script") > /dev/null || true
|
< <(bash "$list_script") > /dev/null || true
|
||||||
|
|
||||||
rm -f "$space_script" "$tab_script" "$list_script" "$fns_file" "$preview_script" "$help_file"
|
rm -f "$space_script" "$tab_script" "$list_script" "$fns_file" "$preview_script" "$copy_script" "$help_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
# ── Installation ──────────────────────────────────────────────────
|
# ── Installation ──────────────────────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user