Skip to content

Commit db42325

Browse files
committed
changes
1 parent 74b83a2 commit db42325

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

netepscript.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,29 @@ RED='\033[0;31m'
77
BOLD='\033[1m'
88
NC='\033[0m'
99

10-
VERSION=$(npm list netepscript -g --depth=0 2>/dev/null | grep netepscript | cut -d@ -f2)
10+
# Función para obtener la versión de npm
11+
get_npm_version() {
12+
npm view netepscript version 2>/dev/null
13+
}
14+
15+
# Función para obtener la versión de GitHub
16+
get_github_version() {
17+
curl -s https://raw.githubusercontent.com/Synergy2Dev/netepScript/main/package.json | grep -oP '"version": "\K[^"]+'
18+
}
19+
20+
# Intenta obtener la versión de npm
21+
VERSION=$(get_npm_version)
22+
23+
# Si no se puede obtener de npm, intenta obtenerla de GitHub
24+
if [ -z "$VERSION" ]; then
25+
VERSION=$(get_github_version)
26+
fi
27+
28+
29+
if [ -z "$VERSION" ]; then
30+
VERSION="desconocida"
31+
echo -e "${YELLOW}Advertencia: No se pudo determinar la versión de netepscript${NC}"
32+
fi
1133

1234
echo -e "${GREEN}=========================================================${NC}"
1335
echo -e "${BLUE} ${BOLD}netepScript v${VERSION}${NC}"

0 commit comments

Comments
 (0)