This commit is contained in:
Moridius 2020-02-14 23:51:54 +01:00
commit 56d4ecdad3
1 changed files with 14 additions and 2 deletions

View File

@ -3,6 +3,7 @@
# Reiko Kaps 2015-2020 <r31k@k4p5.de> # Reiko Kaps 2015-2020 <r31k@k4p5.de>
import argparse import argparse
import json
import subprocess import subprocess
import sys import sys
@ -43,6 +44,11 @@ def list_spaces():
print('{}'.format(name)) print('{}'.format(name))
def details(data, verbose):
"""Show all details"""
print(json.dumps(data, indent=4, sort_keys=True))
def status(json_data, verbose): def status(json_data, verbose):
"""Ermittelt aus dem JSON den Status des Hackerspace""" """Ermittelt aus dem JSON den Status des Hackerspace"""
if verbose is True: if verbose is True:
@ -84,8 +90,9 @@ def getspaceurl(name, debug=False):
def main(args): def main(args):
if args.verbose: if args.verbose:
debug = args.v debug = True
else: else:
debug = False debug = False
@ -100,6 +107,10 @@ def main(args):
print('not connected') print('not connected')
sys.exit(1) sys.exit(1)
if args.details:
details(data, debug)
sys.exit(0)
if args.web: if args.web:
getHomepage(data, debug) getHomepage(data, debug)
sys.exit(0) sys.exit(0)
@ -111,8 +122,9 @@ def main(args):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Show Space Status') parser = argparse.ArgumentParser(description='Show Space Status')
parser.add_argument('-n', '--name', help='Name of Hackerspace', default='LeineLab') parser.add_argument('-n', '--name', help='Name of Hackerspace', default='LeineLab')
parser.add_argument('-d', '--details', help='Shows more details of Hackerspace', default='LeineLab')
parser.add_argument('-l', '--list', action='store_true', help='List all Hackspaces on Spaceapi') parser.add_argument('-l', '--list', action='store_true', help='List all Hackspaces on Spaceapi')
parser.add_argument('-v', '--verbose', action='store_true', help='Show more Infos of Hackspace') parser.add_argument('-v', '--verbose', action='store_true', help='verbose output')
parser.add_argument('-w', '--web', action='store_true', help='get homepage url') parser.add_argument('-w', '--web', action='store_true', help='get homepage url')
args = parser.parse_args() args = parser.parse_args()