Parseado de argumentos creado

This commit is contained in:
2024-04-06 19:42:44 +02:00
commit 534a2a11f3

22
status.py Normal file
View File

@@ -0,0 +1,22 @@
import argparse
def parseArguments():
# Crear un objeto ArgumentParser
parser = argparse.ArgumentParser(description='Ejemplo de script con flags')
# Agregar los argumentos con sus respectivos flags
parser.add_argument('-w', '--web', action='store', dest='web', help='Indicar una web')
parser.add_argument('-h', '--host', action='store', dest='host', help='Indicar un host')
# Parsear los argumentos de la línea de comandos
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parseArguments()
if args.web:
# Parte web, comprobar que Código devuelve
else:
# Parte host, hará ping