-
Notifications
You must be signed in to change notification settings - Fork 0
/
xrshowcli
executable file
·31 lines (23 loc) · 897 Bytes
/
xrshowcli
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
#!/usr/bin/python3
# Author : Hemant Sharma
import sys
import xrshow
import argparse
if __name__ == "__main__":
# Create a parser object to handle command-line arguments
parser = argparse.ArgumentParser(
description="Display show command output on cisco xr",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
# Add an argument for the node hostname
parser.add_argument("-n", help="node hostname")
# Add an argument for the show commands, which can be one or more and separated by whitespace
parser.add_argument(
"-c",
nargs="+",
help="show cmds, if more than one, then whitespace separated please",
)
# Parse the arguments and store them in a variable
args = parser.parse_args()
# Call the xrshow function with the node hostname and the show commands as parameters
xrshow.xrshow(args.n, args.c)