-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate
More file actions
95 lines (76 loc) · 2.02 KB
/
Copy pathtemplate
File metadata and controls
95 lines (76 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
set -o errexit
set -o pipefail
set -o nounset
########################################
# CONFIGURACION
########################################
APP_NAME="nombre-script"
VERSION="0.1.0"
# Necesarias para usar fila_dinamica.
ANCHO_ETIQUETA=22
ANCHO_VALOR=30
########################################
# LIBRERIAS
########################################
# Esta plantilla está pensada para scripts ubicados en la raíz del repositorio.
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
BASE_DIR="$SCRIPT_DIR"
source "$BASE_DIR/.lib/colores.sh"
source "$BASE_DIR/.lib/comunes.sh"
source "$BASE_DIR/.lib/banner.sh"
########################################
# FUNCIONES DE INTERFAZ
########################################
ui_titulo() {
clear
printf '%b\n' "${CYAN}🔰 ${APP_NAME} v${VERSION}${NC}"
linea
}
ui_ayuda() {
printf '%s\n' \
"1) Ejecutar acción de ejemplo" \
"0) Salir" \
"?) Mostrar esta ayuda"
}
########################################
# FUNCIONES PRINCIPALES
########################################
accion_ejemplo() {
printf '%b\n' "${GREEN}Acción ejecutada correctamente.${NC}"
pausa
}
########################################
# MAIN
########################################
main() {
local opcion
while true; do
ui_titulo
printf '%b\n' "${YELLOW}1)${NC} Ejecutar acción de ejemplo"
printf '%b\n' "${YELLOW}0)${NC} Salir"
printf '%b\n' "${YELLOW}?)${NC} Ayuda"
printf '\n'
read -r -p "⭕ Seleccione una opción: " opcion
case "$opcion" in
1)
accion_ejemplo
;;
0)
exit 0
;;
\?)
ui_ayuda
pausa
;;
*)
printf '%b\n' "${RED}Opción inválida.${NC}"
pausa
;;
esac
done
}
########################################
# INICIO
########################################
main "$@"