Merge branch 'master' of https://github.com/reikkaps/spaceapicli
This commit is contained in:
commit
56d4ecdad3
|
@ -3,6 +3,7 @@
|
|||
# Reiko Kaps 2015-2020 <r31k@k4p5.de>
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
@ -43,6 +44,11 @@ def list_spaces():
|
|||
print('{}'.format(name))
|
||||
|
||||
|
||||
def details(data, verbose):
|
||||
"""Show all details"""
|
||||
print(json.dumps(data, indent=4, sort_keys=True))
|
||||
|
||||
|
||||
def status(json_data, verbose):
|
||||
"""Ermittelt aus dem JSON den Status des Hackerspace"""
|
||||
if verbose is True:
|
||||
|
@ -84,8 +90,9 @@ def getspaceurl(name, debug=False):
|
|||
|
||||
|
||||
def main(args):
|
||||
|
||||
if args.verbose:
|
||||
debug = args.v
|
||||
debug = True
|
||||
else:
|
||||
debug = False
|
||||
|
||||
|
@ -100,6 +107,10 @@ def main(args):
|
|||
print('not connected')
|
||||
sys.exit(1)
|
||||
|
||||
if args.details:
|
||||
details(data, debug)
|
||||
sys.exit(0)
|
||||
|
||||
if args.web:
|
||||
getHomepage(data, debug)
|
||||
sys.exit(0)
|
||||
|
@ -111,8 +122,9 @@ def main(args):
|
|||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description='Show Space Status')
|
||||
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('-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')
|
||||
args = parser.parse_args()
|
||||
|
||||
|
|
Loading…
Reference in New Issue