summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xautopeer_shell.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/autopeer_shell.py b/autopeer_shell.py
index c891e63..0e15930 100755
--- a/autopeer_shell.py
+++ b/autopeer_shell.py
@@ -43,7 +43,10 @@ def parse(num_args):
args = arg.split()
if len(args) != num_args:
# TODO: prompt user for each arg that's missing
- doc = f.__doc__.split('\n', 1)[0]
+ if f.__doc__:
+ doc = f.__doc__.split('\n', 1)[0]
+ else:
+ doc = '(undocumented args)'
print(f'Error: wrong number of args', file=sys.stderr)
print(f'Expected {num_args}: {doc}', file=sys.stderr)
print(f'Got {len(args)}: {args}', file=sys.stderr)
@@ -67,6 +70,8 @@ class AutopeerShell(cmd.Cmd):
@parse(0)
def do_ls(self):
+ '''(no args)
+ List your peers'''
curs = DB.execute('SELECT name, endpoint, port FROM peers WHERE asn=:asn', dict(asn=SELECTED_ASN))
print(f'Active peerings for {SELECTED_ASN}:')
while row := curs.fetchone():
@@ -121,6 +126,8 @@ class AutopeerShell(cmd.Cmd):
@parse(1)
def do_delpeer(self, name):
+ '''<name>
+ Delete your peering'''
curs = DB.execute(
'DELETE FROM peers WHERE name = :name AND asn = :asn',
dict(name=name, asn=SELECTED_ASN)
@@ -144,16 +151,21 @@ My Tunnel IPv6LL: {me.ipll}
Your endpoint: {you.endpoint}:{you.port}
Your ASN: {you.asn}
-My Wireguard Public Key: {you.pubkey}
-My Tunnel IPv6LL: {you.ipll}
+Your Wireguard Public Key: {you.pubkey}
+Your Tunnel IPv6LL: {you.ipll}
''')
@parse(1)
def do_showbird(self, name):
+ '''<name>
+ Show basic bird config'''
print(_bird_config(name, _get_my_info(SELECTED_ASN), _get_peer_info(name, SELECTED_ASN)))
@parse(1)
def do_showwg(self, name):
+ '''<name>
+ Show basic Wireguard config
+ '''
print(_wg_config(name, _get_my_info(SELECTED_ASN), _get_peer_info(name, SELECTED_ASN)))
@parse(1)