add 1 character arguments

This commit is contained in:
fluzzi 2022-04-04 14:41:51 -03:00
parent e4e82ef1c6
commit c09703053b
4 changed files with 67 additions and 62 deletions

View File

@ -70,12 +70,13 @@ positional arguments:
#### Options: #### Options:
``` ```
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new node[@subfolder][@folder] or [@subfolder]@folder -a, --add Add new node[@subfolder][@folder] or [@subfolder]@folder
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder -r, --del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
--mod, --edit Modify node[@subfolder][@folder] -e, --mod, --edit Modify node[@subfolder][@folder]
--show Show node[@subfolder][@folder] -s, --show Show node[@subfolder][@folder]
--debug, -d Display all conections steps -d, --debug Display all conections steps
``` ```
#### Commands: #### Commands:
@ -96,11 +97,12 @@ positional arguments:
profile Name of profile to manage profile Name of profile to manage
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new profile -a, --add Add new profile
--del, --rm Delete profile -r, --del, --rm Delete profile
--mod, --edit Modify profile -e, --mod, --edit Modify profile
--show Show profile -s, --show Show profile
``` ```
#### Examples: #### Examples:

View File

@ -23,12 +23,12 @@ positional arguments:
[@subfolder][@folder] [@subfolder][@folder]
Show all available connections globaly or in specified path Show all available connections globaly or in specified path
Options: Options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new node[@subfolder][@folder] or [@subfolder]@folder -a, --add Add new node[@subfolder][@folder] or [@subfolder]@folder
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder -r, --del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
--mod, --edit Modify node[@subfolder][@folder] -e, --mod, --edit Modify node[@subfolder][@folder]
--show Show node[@subfolder][@folder] -s, --show Show node[@subfolder][@folder]
--debug, -d Display all conections steps -d, --debug Display all conections steps
Commands: Commands:
profile Manage profiles profile Manage profiles
@ -47,11 +47,12 @@ positional arguments:
profile Name of profile to manage profile Name of profile to manage
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new profile -a, --add Add new profile
--del, --rm Delete profile -r, --del, --rm Delete profile
--mod, --edit Modify profile -e, --mod, --edit Modify profile
--show Show profile -s, --show Show profile
``` ```
### Examples ### Examples

View File

@ -40,20 +40,20 @@ class connapp:
nodeparser = subparsers.add_parser("node",usage=self._help("usage"), help=self._help("node"),epilog=self._help("end"), formatter_class=argparse.RawTextHelpFormatter) nodeparser = subparsers.add_parser("node",usage=self._help("usage"), help=self._help("node"),epilog=self._help("end"), formatter_class=argparse.RawTextHelpFormatter)
nodecrud = nodeparser.add_mutually_exclusive_group() nodecrud = nodeparser.add_mutually_exclusive_group()
nodeparser.add_argument("node", metavar="node|folder", nargs='?', default=None, action=self._store_type, type=self._type_node, help=self._help("node")) nodeparser.add_argument("node", metavar="node|folder", nargs='?', default=None, action=self._store_type, type=self._type_node, help=self._help("node"))
nodecrud.add_argument("--add", dest="action", action="store_const", help="Add new node[@subfolder][@folder] or [@subfolder]@folder", const="add", default="connect") nodecrud.add_argument("-a","--add", dest="action", action="store_const", help="Add new node[@subfolder][@folder] or [@subfolder]@folder", const="add", default="connect")
nodecrud.add_argument("--del", "--rm", dest="action", action="store_const", help="Delete node[@subfolder][@folder] or [@subfolder]@folder", const="del", default="connect") nodecrud.add_argument("-r","--del", "--rm", dest="action", action="store_const", help="Delete node[@subfolder][@folder] or [@subfolder]@folder", const="del", default="connect")
nodecrud.add_argument("--mod", "--edit", dest="action", action="store_const", help="Modify node[@subfolder][@folder]", const="mod", default="connect") nodecrud.add_argument("-e","--mod", "--edit", dest="action", action="store_const", help="Modify node[@subfolder][@folder]", const="mod", default="connect")
nodecrud.add_argument("--show", dest="action", action="store_const", help="Show node[@subfolder][@folder]", const="show", default="connect") nodecrud.add_argument("-s","--show", dest="action", action="store_const", help="Show node[@subfolder][@folder]", const="show", default="connect")
nodecrud.add_argument("--debug", "-d", dest="action", action="store_const", help="Display all conections steps", const="debug", default="connect") nodecrud.add_argument("-d","--debug", dest="action", action="store_const", help="Display all conections steps", const="debug", default="connect")
nodeparser.set_defaults(func=self._func_node) nodeparser.set_defaults(func=self._func_node)
#PROFILEPARSER #PROFILEPARSER
profileparser = subparsers.add_parser("profile", help="Manage profiles") profileparser = subparsers.add_parser("profile", help="Manage profiles")
profileparser.add_argument("profile", nargs=1, action=self._store_type, type=self._type_profile, help="Name of profile to manage") profileparser.add_argument("profile", nargs=1, action=self._store_type, type=self._type_profile, help="Name of profile to manage")
profilecrud = profileparser.add_mutually_exclusive_group(required=True) profilecrud = profileparser.add_mutually_exclusive_group(required=True)
profilecrud.add_argument("--add", dest="action", action="store_const", help="Add new profile", const="add") profilecrud.add_argument("-a", "--add", dest="action", action="store_const", help="Add new profile", const="add")
profilecrud.add_argument("--del", "--rm", dest="action", action="store_const", help="Delete profile", const="del") profilecrud.add_argument("-r", "--del", "--rm", dest="action", action="store_const", help="Delete profile", const="del")
profilecrud.add_argument("--mod", "--edit", dest="action", action="store_const", help="Modify profile", const="mod") profilecrud.add_argument("-e", "--mod", "--edit", dest="action", action="store_const", help="Modify profile", const="mod")
profilecrud.add_argument("--show", dest="action", action="store_const", help="Show profile", const="show") profilecrud.add_argument("-s", "--show", dest="action", action="store_const", help="Show profile", const="show")
profileparser.set_defaults(func=self._func_profile) profileparser.set_defaults(func=self._func_profile)
#MOVEPARSER #MOVEPARSER
moveparser = subparsers.add_parser("move", aliases=["mv"], help="Move node") moveparser = subparsers.add_parser("move", aliases=["mv"], help="Move node")

View File

@ -42,12 +42,12 @@ positional arguments:
[@subfolder][@folder] [@subfolder][@folder]
Show all available connections globaly or in specified path Show all available connections globaly or in specified path
Options: Options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new node[@subfolder][@folder] or [@subfolder]@folder -a, --add Add new node[@subfolder][@folder] or [@subfolder]@folder
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder -r, --del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
--mod, --edit Modify node[@subfolder][@folder] -e, --mod, --edit Modify node[@subfolder][@folder]
--show Show node[@subfolder][@folder] -s, --show Show node[@subfolder][@folder]
--debug, -d Display all conections steps -d, --debug Display all conections steps
Commands: Commands:
profile Manage profiles profile Manage profiles
@ -64,11 +64,12 @@ positional arguments:
profile Name of profile to manage profile Name of profile to manage
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new profile -a, --add Add new profile
--del, --rm Delete profile -r, --del, --rm Delete profile
--mod, --edit Modify profile -e, --mod, --edit Modify profile
--show Show profile -s, --show Show profile
</code></pre> </code></pre>
<h3 id="examples">Examples</h3> <h3 id="examples">Examples</h3>
<pre><code> conn profile --add office-user <pre><code> conn profile --add office-user
@ -155,12 +156,12 @@ positional arguments:
[@subfolder][@folder] [@subfolder][@folder]
Show all available connections globaly or in specified path Show all available connections globaly or in specified path
Options: Options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new node[@subfolder][@folder] or [@subfolder]@folder -a, --add Add new node[@subfolder][@folder] or [@subfolder]@folder
--del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder -r, --del, --rm Delete node[@subfolder][@folder] or [@subfolder]@folder
--mod, --edit Modify node[@subfolder][@folder] -e, --mod, --edit Modify node[@subfolder][@folder]
--show Show node[@subfolder][@folder] -s, --show Show node[@subfolder][@folder]
--debug, -d Display all conections steps -d, --debug Display all conections steps
Commands: Commands:
profile Manage profiles profile Manage profiles
@ -179,11 +180,12 @@ positional arguments:
profile Name of profile to manage profile Name of profile to manage
options: options:
-h, --help show this help message and exit -h, --help show this help message and exit
--add Add new profile -a, --add Add new profile
--del, --rm Delete profile -r, --del, --rm Delete profile
--mod, --edit Modify profile -e, --mod, --edit Modify profile
--show Show profile -s, --show Show profile
``` ```
### Examples ### Examples
@ -637,20 +639,20 @@ __pdoc__ = {
nodeparser = subparsers.add_parser(&#34;node&#34;,usage=self._help(&#34;usage&#34;), help=self._help(&#34;node&#34;),epilog=self._help(&#34;end&#34;), formatter_class=argparse.RawTextHelpFormatter) nodeparser = subparsers.add_parser(&#34;node&#34;,usage=self._help(&#34;usage&#34;), help=self._help(&#34;node&#34;),epilog=self._help(&#34;end&#34;), formatter_class=argparse.RawTextHelpFormatter)
nodecrud = nodeparser.add_mutually_exclusive_group() nodecrud = nodeparser.add_mutually_exclusive_group()
nodeparser.add_argument(&#34;node&#34;, metavar=&#34;node|folder&#34;, nargs=&#39;?&#39;, default=None, action=self._store_type, type=self._type_node, help=self._help(&#34;node&#34;)) nodeparser.add_argument(&#34;node&#34;, metavar=&#34;node|folder&#34;, nargs=&#39;?&#39;, default=None, action=self._store_type, type=self._type_node, help=self._help(&#34;node&#34;))
nodecrud.add_argument(&#34;--add&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Add new node[@subfolder][@folder] or [@subfolder]@folder&#34;, const=&#34;add&#34;, default=&#34;connect&#34;) nodecrud.add_argument(&#34;-a&#34;,&#34;--add&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Add new node[@subfolder][@folder] or [@subfolder]@folder&#34;, const=&#34;add&#34;, default=&#34;connect&#34;)
nodecrud.add_argument(&#34;--del&#34;, &#34;--rm&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Delete node[@subfolder][@folder] or [@subfolder]@folder&#34;, const=&#34;del&#34;, default=&#34;connect&#34;) nodecrud.add_argument(&#34;-r&#34;,&#34;--del&#34;, &#34;--rm&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Delete node[@subfolder][@folder] or [@subfolder]@folder&#34;, const=&#34;del&#34;, default=&#34;connect&#34;)
nodecrud.add_argument(&#34;--mod&#34;, &#34;--edit&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Modify node[@subfolder][@folder]&#34;, const=&#34;mod&#34;, default=&#34;connect&#34;) nodecrud.add_argument(&#34;-e&#34;,&#34;--mod&#34;, &#34;--edit&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Modify node[@subfolder][@folder]&#34;, const=&#34;mod&#34;, default=&#34;connect&#34;)
nodecrud.add_argument(&#34;--show&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Show node[@subfolder][@folder]&#34;, const=&#34;show&#34;, default=&#34;connect&#34;) nodecrud.add_argument(&#34;-s&#34;,&#34;--show&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Show node[@subfolder][@folder]&#34;, const=&#34;show&#34;, default=&#34;connect&#34;)
nodecrud.add_argument(&#34;--debug&#34;, &#34;-d&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Display all conections steps&#34;, const=&#34;debug&#34;, default=&#34;connect&#34;) nodecrud.add_argument(&#34;-d&#34;,&#34;--debug&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Display all conections steps&#34;, const=&#34;debug&#34;, default=&#34;connect&#34;)
nodeparser.set_defaults(func=self._func_node) nodeparser.set_defaults(func=self._func_node)
#PROFILEPARSER #PROFILEPARSER
profileparser = subparsers.add_parser(&#34;profile&#34;, help=&#34;Manage profiles&#34;) profileparser = subparsers.add_parser(&#34;profile&#34;, help=&#34;Manage profiles&#34;)
profileparser.add_argument(&#34;profile&#34;, nargs=1, action=self._store_type, type=self._type_profile, help=&#34;Name of profile to manage&#34;) profileparser.add_argument(&#34;profile&#34;, nargs=1, action=self._store_type, type=self._type_profile, help=&#34;Name of profile to manage&#34;)
profilecrud = profileparser.add_mutually_exclusive_group(required=True) profilecrud = profileparser.add_mutually_exclusive_group(required=True)
profilecrud.add_argument(&#34;--add&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Add new profile&#34;, const=&#34;add&#34;) profilecrud.add_argument(&#34;-a&#34;, &#34;--add&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Add new profile&#34;, const=&#34;add&#34;)
profilecrud.add_argument(&#34;--del&#34;, &#34;--rm&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Delete profile&#34;, const=&#34;del&#34;) profilecrud.add_argument(&#34;-r&#34;, &#34;--del&#34;, &#34;--rm&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Delete profile&#34;, const=&#34;del&#34;)
profilecrud.add_argument(&#34;--mod&#34;, &#34;--edit&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Modify profile&#34;, const=&#34;mod&#34;) profilecrud.add_argument(&#34;-e&#34;, &#34;--mod&#34;, &#34;--edit&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Modify profile&#34;, const=&#34;mod&#34;)
profilecrud.add_argument(&#34;--show&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Show profile&#34;, const=&#34;show&#34;) profilecrud.add_argument(&#34;-s&#34;, &#34;--show&#34;, dest=&#34;action&#34;, action=&#34;store_const&#34;, help=&#34;Show profile&#34;, const=&#34;show&#34;)
profileparser.set_defaults(func=self._func_profile) profileparser.set_defaults(func=self._func_profile)
#MOVEPARSER #MOVEPARSER
moveparser = subparsers.add_parser(&#34;move&#34;, aliases=[&#34;mv&#34;], help=&#34;Move node&#34;) moveparser = subparsers.add_parser(&#34;move&#34;, aliases=[&#34;mv&#34;], help=&#34;Move node&#34;)