working on documentation
This commit is contained in:
parent
5769d4a5af
commit
de2c2ab21b
@ -1,9 +1,61 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
'''
|
'''
|
||||||
|
## Connection manager
|
||||||
|
```
|
||||||
|
usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder]
|
||||||
|
conn {profile,move,mv,copy,cp,list,ls,bulk,config} ...
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
node|folder node[@subfolder][@folder]
|
||||||
|
Connect to specific node or show all matching nodes
|
||||||
|
[@subfolder][@folder]
|
||||||
|
Show all available connections globaly or in specified path
|
||||||
|
Options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--mod, --edit Modify node[@subfolder][@folder]
|
||||||
|
--show Show node[@subfolder][@folder]
|
||||||
|
--debug, -d Display all conections steps
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
profile Manage profiles
|
||||||
|
move (mv) Move node
|
||||||
|
copy (cp) Copy node
|
||||||
|
list (ls) List profiles, nodes or folders
|
||||||
|
bulk Add nodes in bulk
|
||||||
|
config Manage app config
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manage profiles
|
||||||
|
```
|
||||||
|
usage: conn profile [-h] (--add | --del | --mod | --show) profile
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
profile Name of profile to manage
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new profile
|
||||||
|
--del, --rm Delete profile
|
||||||
|
--mod, --edit Modify profile
|
||||||
|
--show Show profile
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
```
|
||||||
|
conn profile --add office-user
|
||||||
|
conn --add @office
|
||||||
|
conn --add @datacenter@office
|
||||||
|
conn --add server@datacenter@office
|
||||||
|
conn --add pc@office
|
||||||
|
conn --show server@datacenter@office
|
||||||
|
conn pc@office
|
||||||
|
conn server
|
||||||
|
```
|
||||||
'''
|
'''
|
||||||
from .core import node,nodes
|
from .core import node,nodes
|
||||||
from .configfile import configfile
|
from .configfile import configfile
|
||||||
from .connapp import connapp
|
|
||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution
|
||||||
|
|
||||||
__all__ = ["node", "nodes", "configfile"]
|
__all__ = ["node", "nodes", "configfile"]
|
||||||
|
@ -15,7 +15,9 @@ from conn import *
|
|||||||
#functions and classes
|
#functions and classes
|
||||||
|
|
||||||
class connapp:
|
class connapp:
|
||||||
|
# Class that starts the connection manager app.
|
||||||
def __init__(self, config, node):
|
def __init__(self, config, node):
|
||||||
|
#Define the parser for the arguments
|
||||||
self.node = node
|
self.node = node
|
||||||
self.config = config
|
self.config = config
|
||||||
self.nodes = self._getallnodes()
|
self.nodes = self._getallnodes()
|
||||||
@ -78,12 +80,14 @@ class connapp:
|
|||||||
args.func(args)
|
args.func(args)
|
||||||
|
|
||||||
class _store_type(argparse.Action):
|
class _store_type(argparse.Action):
|
||||||
|
#Custom store type for cli app.
|
||||||
def __call__(self, parser, args, values, option_string=None):
|
def __call__(self, parser, args, values, option_string=None):
|
||||||
setattr(args, "data", values)
|
setattr(args, "data", values)
|
||||||
delattr(args,self.dest)
|
delattr(args,self.dest)
|
||||||
setattr(args, "command", self.dest)
|
setattr(args, "command", self.dest)
|
||||||
|
|
||||||
def _func_node(self, args):
|
def _func_node(self, args):
|
||||||
|
#Function called when connecting or managing nodes.
|
||||||
if not self.case and args.data != None:
|
if not self.case and args.data != None:
|
||||||
args.data = args.data.lower()
|
args.data = args.data.lower()
|
||||||
if args.action == "connect" or args.action == "debug":
|
if args.action == "connect" or args.action == "debug":
|
||||||
@ -228,6 +232,7 @@ class connapp:
|
|||||||
|
|
||||||
|
|
||||||
def _func_profile(self, args):
|
def _func_profile(self, args):
|
||||||
|
#Function called when managing profiles
|
||||||
if not self.case:
|
if not self.case:
|
||||||
args.data[0] = args.data[0].lower()
|
args.data[0] = args.data[0].lower()
|
||||||
if args.action == "del":
|
if args.action == "del":
|
||||||
@ -296,6 +301,7 @@ class connapp:
|
|||||||
print("{} edited succesfully".format(args.data[0]))
|
print("{} edited succesfully".format(args.data[0]))
|
||||||
|
|
||||||
def _func_others(self, args):
|
def _func_others(self, args):
|
||||||
|
#Function called when using other commands
|
||||||
if args.command == "ls":
|
if args.command == "ls":
|
||||||
print(*getattr(self, args.data), sep="\n")
|
print(*getattr(self, args.data), sep="\n")
|
||||||
elif args.command == "move" or args.command == "cp":
|
elif args.command == "move" or args.command == "cp":
|
||||||
@ -390,6 +396,7 @@ class connapp:
|
|||||||
print("Config saved")
|
print("Config saved")
|
||||||
|
|
||||||
def _choose(self, list, name, action):
|
def _choose(self, list, name, action):
|
||||||
|
#Generates an inquirer list to pick
|
||||||
questions = [inquirer.List(name, message="Pick {} to {}:".format(name,action), choices=list, carousel=True)]
|
questions = [inquirer.List(name, message="Pick {} to {}:".format(name,action), choices=list, carousel=True)]
|
||||||
answer = inquirer.prompt(questions)
|
answer = inquirer.prompt(questions)
|
||||||
if answer == None:
|
if answer == None:
|
||||||
@ -398,6 +405,7 @@ class connapp:
|
|||||||
return answer[name]
|
return answer[name]
|
||||||
|
|
||||||
def _host_validation(self, answers, current, regex = "^.+$"):
|
def _host_validation(self, answers, current, regex = "^.+$"):
|
||||||
|
#Validate hostname in inquirer when managing nodes
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
||||||
if current.startswith("@"):
|
if current.startswith("@"):
|
||||||
@ -406,11 +414,13 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _profile_protocol_validation(self, answers, current, regex = "(^ssh$|^telnet$|^$)"):
|
def _profile_protocol_validation(self, answers, current, regex = "(^ssh$|^telnet$|^$)"):
|
||||||
|
#Validate protocol in inquirer when managing profiles
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Pick between ssh, telnet or leave empty")
|
raise inquirer.errors.ValidationError("", reason="Pick between ssh, telnet or leave empty")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _protocol_validation(self, answers, current, regex = "(^ssh$|^telnet$|^$|^@.+$)"):
|
def _protocol_validation(self, answers, current, regex = "(^ssh$|^telnet$|^$|^@.+$)"):
|
||||||
|
#Validate protocol in inquirer when managing nodes
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Pick between ssh, telnet, leave empty or @profile")
|
raise inquirer.errors.ValidationError("", reason="Pick between ssh, telnet, leave empty or @profile")
|
||||||
if current.startswith("@"):
|
if current.startswith("@"):
|
||||||
@ -419,6 +429,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _profile_port_validation(self, answers, current, regex = "(^[0-9]*$)"):
|
def _profile_port_validation(self, answers, current, regex = "(^[0-9]*$)"):
|
||||||
|
#Validate port in inquirer when managing profiles
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Pick a port between 1-65535, @profile o leave empty")
|
raise inquirer.errors.ValidationError("", reason="Pick a port between 1-65535, @profile o leave empty")
|
||||||
try:
|
try:
|
||||||
@ -430,6 +441,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _port_validation(self, answers, current, regex = "(^[0-9]*$|^@.+$)"):
|
def _port_validation(self, answers, current, regex = "(^[0-9]*$|^@.+$)"):
|
||||||
|
#Validate port in inquirer when managing nodes
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Pick a port between 1-65535, @profile or leave empty")
|
raise inquirer.errors.ValidationError("", reason="Pick a port between 1-65535, @profile or leave empty")
|
||||||
try:
|
try:
|
||||||
@ -444,6 +456,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _pass_validation(self, answers, current, regex = "(^@.+$)"):
|
def _pass_validation(self, answers, current, regex = "(^@.+$)"):
|
||||||
|
#Validate password in inquirer
|
||||||
profiles = current.split(",")
|
profiles = current.split(",")
|
||||||
for i in profiles:
|
for i in profiles:
|
||||||
if not re.match(regex, i) or i[1:] not in self.profiles:
|
if not re.match(regex, i) or i[1:] not in self.profiles:
|
||||||
@ -451,12 +464,14 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _default_validation(self, answers, current):
|
def _default_validation(self, answers, current):
|
||||||
|
#Default validation type used in multiples questions in inquirer
|
||||||
if current.startswith("@"):
|
if current.startswith("@"):
|
||||||
if current[1:] not in self.profiles:
|
if current[1:] not in self.profiles:
|
||||||
raise inquirer.errors.ValidationError("", reason="Profile {} don't exist".format(current))
|
raise inquirer.errors.ValidationError("", reason="Profile {} don't exist".format(current))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _bulk_node_validation(self, answers, current, regex = "^[0-9a-zA-Z_.,$#-]+$"):
|
def _bulk_node_validation(self, answers, current, regex = "^[0-9a-zA-Z_.,$#-]+$"):
|
||||||
|
#Validation of nodes when running bulk command
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
||||||
if current.startswith("@"):
|
if current.startswith("@"):
|
||||||
@ -465,6 +480,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _bulk_folder_validation(self, answers, current):
|
def _bulk_folder_validation(self, answers, current):
|
||||||
|
#Validation of folders when running bulk command
|
||||||
if not self.case:
|
if not self.case:
|
||||||
current = current.lower()
|
current = current.lower()
|
||||||
matches = list(filter(lambda k: k == current, self.folders))
|
matches = list(filter(lambda k: k == current, self.folders))
|
||||||
@ -473,6 +489,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _bulk_host_validation(self, answers, current, regex = "^.+$"):
|
def _bulk_host_validation(self, answers, current, regex = "^.+$"):
|
||||||
|
#Validate hostname when running bulk command
|
||||||
if not re.match(regex, current):
|
if not re.match(regex, current):
|
||||||
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
raise inquirer.errors.ValidationError("", reason="Host cannot be empty")
|
||||||
if current.startswith("@"):
|
if current.startswith("@"):
|
||||||
@ -485,6 +502,7 @@ class connapp:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def _questions_edit(self):
|
def _questions_edit(self):
|
||||||
|
#Inquirer questions when editing nodes or profiles
|
||||||
questions = []
|
questions = []
|
||||||
questions.append(inquirer.Confirm("host", message="Edit Hostname/IP?"))
|
questions.append(inquirer.Confirm("host", message="Edit Hostname/IP?"))
|
||||||
questions.append(inquirer.Confirm("protocol", message="Edit Protocol?"))
|
questions.append(inquirer.Confirm("protocol", message="Edit Protocol?"))
|
||||||
@ -497,6 +515,7 @@ class connapp:
|
|||||||
return answers
|
return answers
|
||||||
|
|
||||||
def _questions_nodes(self, unique, uniques = None, edit = None):
|
def _questions_nodes(self, unique, uniques = None, edit = None):
|
||||||
|
#Questions when adding or editing nodes
|
||||||
try:
|
try:
|
||||||
defaults = self.config.getitem(unique)
|
defaults = self.config.getitem(unique)
|
||||||
except:
|
except:
|
||||||
@ -557,6 +576,7 @@ class connapp:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _questions_profiles(self, unique, edit = None):
|
def _questions_profiles(self, unique, edit = None):
|
||||||
|
#Questions when adding or editing profiles
|
||||||
try:
|
try:
|
||||||
defaults = self.config.profiles[unique]
|
defaults = self.config.profiles[unique]
|
||||||
except:
|
except:
|
||||||
@ -604,6 +624,7 @@ class connapp:
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _questions_bulk(self):
|
def _questions_bulk(self):
|
||||||
|
#Questions when using bulk command
|
||||||
questions = []
|
questions = []
|
||||||
questions.append(inquirer.Text("ids", message="add a comma separated list of nodes to add", validate=self._bulk_node_validation))
|
questions.append(inquirer.Text("ids", message="add a comma separated list of nodes to add", validate=self._bulk_node_validation))
|
||||||
questions.append(inquirer.Text("location", message="Add a @folder, @subfolder@folder or leave empty", validate=self._bulk_folder_validation))
|
questions.append(inquirer.Text("location", message="Add a @folder, @subfolder@folder or leave empty", validate=self._bulk_folder_validation))
|
||||||
@ -642,6 +663,7 @@ class connapp:
|
|||||||
return arg_value
|
return arg_value
|
||||||
|
|
||||||
def _help(self, type):
|
def _help(self, type):
|
||||||
|
#Store text for help and other commands
|
||||||
if type == "node":
|
if type == "node":
|
||||||
return "node[@subfolder][@folder]\nConnect to specific node or show all matching nodes\n[@subfolder][@folder]\nShow all available connections globaly or in specified path"
|
return "node[@subfolder][@folder]\nConnect to specific node or show all matching nodes\n[@subfolder][@folder]\nShow all available connections globaly or in specified path"
|
||||||
if type == "usage":
|
if type == "usage":
|
||||||
@ -697,6 +719,7 @@ complete -o nosort -F _conn conn
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def _getallnodes(self):
|
def _getallnodes(self):
|
||||||
|
#get all nodes on configfile
|
||||||
nodes = []
|
nodes = []
|
||||||
layer1 = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "connection"]
|
layer1 = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "connection"]
|
||||||
folders = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
folders = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
||||||
@ -711,6 +734,7 @@ complete -o nosort -F _conn conn
|
|||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
def _getallfolders(self):
|
def _getallfolders(self):
|
||||||
|
#get all folders on configfile
|
||||||
folders = ["@" + k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
folders = ["@" + k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
||||||
subfolders = []
|
subfolders = []
|
||||||
for f in folders:
|
for f in folders:
|
||||||
@ -720,6 +744,7 @@ complete -o nosort -F _conn conn
|
|||||||
return folders
|
return folders
|
||||||
|
|
||||||
def _profileused(self, profile):
|
def _profileused(self, profile):
|
||||||
|
#Check if profile is used before deleting it
|
||||||
nodes = []
|
nodes = []
|
||||||
layer1 = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "connection" and ("@" + profile in v.values() or ( isinstance(v["password"],list) and "@" + profile in v["password"]))]
|
layer1 = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "connection" and ("@" + profile in v.values() or ( isinstance(v["password"],list) and "@" + profile in v["password"]))]
|
||||||
folders = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
folders = [k for k,v in self.config.connections.items() if isinstance(v, dict) and v["type"] == "folder"]
|
||||||
@ -734,6 +759,7 @@ complete -o nosort -F _conn conn
|
|||||||
return nodes
|
return nodes
|
||||||
|
|
||||||
def encrypt(self, password, keyfile=None):
|
def encrypt(self, password, keyfile=None):
|
||||||
|
#Encrypt password using keyfile
|
||||||
if keyfile is None:
|
if keyfile is None:
|
||||||
keyfile = self.config.key
|
keyfile = self.config.key
|
||||||
key = RSA.import_key(open(keyfile).read())
|
key = RSA.import_key(open(keyfile).read())
|
||||||
|
@ -5,7 +5,10 @@
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
|
||||||
<meta name="generator" content="pdoc 0.10.0" />
|
<meta name="generator" content="pdoc 0.10.0" />
|
||||||
<title>conn API documentation</title>
|
<title>conn API documentation</title>
|
||||||
<meta name="description" content="" />
|
<meta name="description" content="Connection manager
|
||||||
|
```
|
||||||
|
usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder]
|
||||||
|
conn …" />
|
||||||
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
|
||||||
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
|
||||||
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/fundation.min.css" crossorigin>
|
<link rel="stylesheet preload" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/fundation.min.css" crossorigin>
|
||||||
@ -22,12 +25,113 @@
|
|||||||
<h1 class="title">Package <code>conn</code></h1>
|
<h1 class="title">Package <code>conn</code></h1>
|
||||||
</header>
|
</header>
|
||||||
<section id="section-intro">
|
<section id="section-intro">
|
||||||
|
<h2 id="connection-manager">Connection manager</h2>
|
||||||
|
<pre><code>usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder]
|
||||||
|
conn {profile,move,mv,copy,cp,list,ls,bulk,config} ...
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
node|folder node[@subfolder][@folder]
|
||||||
|
Connect to specific node or show all matching nodes
|
||||||
|
[@subfolder][@folder]
|
||||||
|
Show all available connections globaly or in specified path
|
||||||
|
Options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--mod, --edit Modify node[@subfolder][@folder]
|
||||||
|
--show Show node[@subfolder][@folder]
|
||||||
|
--debug, -d Display all conections steps
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
profile Manage profiles
|
||||||
|
move (mv) Move node
|
||||||
|
copy (cp) Copy node
|
||||||
|
list (ls) List profiles, nodes or folders
|
||||||
|
bulk Add nodes in bulk
|
||||||
|
config Manage app config
|
||||||
|
</code></pre>
|
||||||
|
<h4 id="manage-profiles">Manage profiles</h4>
|
||||||
|
<pre><code>usage: conn profile [-h] (--add | --del | --mod | --show) profile
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
profile Name of profile to manage
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new profile
|
||||||
|
--del, --rm Delete profile
|
||||||
|
--mod, --edit Modify profile
|
||||||
|
--show Show profile
|
||||||
|
</code></pre>
|
||||||
|
<h4 id="examples">Examples</h4>
|
||||||
|
<pre><code> conn profile --add office-user
|
||||||
|
conn --add @office
|
||||||
|
conn --add @datacenter@office
|
||||||
|
conn --add server@datacenter@office
|
||||||
|
conn --add pc@office
|
||||||
|
conn --show server@datacenter@office
|
||||||
|
conn pc@office
|
||||||
|
conn server
|
||||||
|
</code></pre>
|
||||||
<details class="source">
|
<details class="source">
|
||||||
<summary>
|
<summary>
|
||||||
<span>Expand source code</span>
|
<span>Expand source code</span>
|
||||||
</summary>
|
</summary>
|
||||||
<pre><code class="python">#!/usr/bin/env python3
|
<pre><code class="python">#!/usr/bin/env python3
|
||||||
'''
|
'''
|
||||||
|
## Connection manager
|
||||||
|
```
|
||||||
|
usage: conn [-h] [--add | --del | --mod | --show | --debug] [node|folder]
|
||||||
|
conn {profile,move,mv,copy,cp,list,ls,bulk,config} ...
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
node|folder node[@subfolder][@folder]
|
||||||
|
Connect to specific node or show all matching nodes
|
||||||
|
[@subfolder][@folder]
|
||||||
|
Show all available connections globaly or in specified path
|
||||||
|
Options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
|
||||||
|
--mod, --edit Modify node[@subfolder][@folder]
|
||||||
|
--show Show node[@subfolder][@folder]
|
||||||
|
--debug, -d Display all conections steps
|
||||||
|
|
||||||
|
Commands:
|
||||||
|
profile Manage profiles
|
||||||
|
move (mv) Move node
|
||||||
|
copy (cp) Copy node
|
||||||
|
list (ls) List profiles, nodes or folders
|
||||||
|
bulk Add nodes in bulk
|
||||||
|
config Manage app config
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Manage profiles
|
||||||
|
```
|
||||||
|
usage: conn profile [-h] (--add | --del | --mod | --show) profile
|
||||||
|
|
||||||
|
positional arguments:
|
||||||
|
profile Name of profile to manage
|
||||||
|
|
||||||
|
options:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--add Add new profile
|
||||||
|
--del, --rm Delete profile
|
||||||
|
--mod, --edit Modify profile
|
||||||
|
--show Show profile
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Examples
|
||||||
|
```
|
||||||
|
conn profile --add office-user
|
||||||
|
conn --add @office
|
||||||
|
conn --add @datacenter@office
|
||||||
|
conn --add server@datacenter@office
|
||||||
|
conn --add pc@office
|
||||||
|
conn --show server@datacenter@office
|
||||||
|
conn pc@office
|
||||||
|
conn server
|
||||||
|
```
|
||||||
'''
|
'''
|
||||||
from .core import node,nodes
|
from .core import node,nodes
|
||||||
from .configfile import configfile
|
from .configfile import configfile
|
||||||
@ -1345,7 +1449,13 @@ expected (str) : Expected text to appear after running all the
|
|||||||
<nav id="sidebar">
|
<nav id="sidebar">
|
||||||
<h1>Index</h1>
|
<h1>Index</h1>
|
||||||
<div class="toc">
|
<div class="toc">
|
||||||
<ul></ul>
|
<ul>
|
||||||
|
<li><a href="#connection-manager">Connection manager</a><ul>
|
||||||
|
<li><a href="#manage-profiles">Manage profiles</a></li>
|
||||||
|
<li><a href="#examples">Examples</a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<ul id="index">
|
<ul id="index">
|
||||||
<li><h3><a href="#header-classes">Classes</a></h3>
|
<li><h3><a href="#header-classes">Classes</a></h3>
|
||||||
|
@ -9,6 +9,9 @@ author_mail = fluzzi@gmail.com
|
|||||||
url = https://github.com/fluzzi/connpy
|
url = https://github.com/fluzzi/connpy
|
||||||
license = MIT License
|
license = MIT License
|
||||||
license_files = LICENSE
|
license_files = LICENSE
|
||||||
|
project_urls =
|
||||||
|
Bug Tracker = https://github.com/fluzzi/connpy/issues
|
||||||
|
Documentation = https://fluzzi.github.io/connpy/
|
||||||
classifiers =
|
classifiers =
|
||||||
Development Status :: 4 - Beta
|
Development Status :: 4 - Beta
|
||||||
Topic :: System :: Networking
|
Topic :: System :: Networking
|
||||||
|
Loading…
Reference in New Issue
Block a user