bugfixes (still buggy)

This commit is contained in:
Kload 2013-07-02 20:16:54 +00:00
parent 03454f2570
commit 5c2fa667a4

View file

@ -34,6 +34,7 @@ def main():
resource_list = base_info resource_list = base_info
resources = {} resources = {}
del action_map['general_arguments']
for category, category_params in action_map.items(): for category, category_params in action_map.items():
if 'category_help' not in category_params: category_params['category_help'] = '' if 'category_help' not in category_params: category_params['category_help'] = ''
resource_path = '/'+ category resource_path = '/'+ category
@ -81,14 +82,15 @@ def main():
required = True required = True
allowable_values = {} allowable_values = {}
name = arg_name.replace('-', '_') name = arg_name.replace('-', '_')
if name[0] == '_': if name[0] == '-':
required = False required = False
if 'nargs' not in arg_params: if 'nargs' not in arg_params:
allow_multiple = False allow_multiple = False
if 'full' in arg_params: if 'full' in arg_params:
name = arg_params['full'][2:].replace('-', '_') name = arg_params['full'][2:]
else: else:
name = arg_params[2:].replace('-', '_') name = arg_params[2:]
name = name.replace('-', '_')
if name == key_param: if name == key_param:
param_type = 'path' param_type = 'path'
@ -132,17 +134,19 @@ def main():
resources[category]['apis'].append({ resources[category]['apis'].append({
'path': path, 'path': path,
'description': action_params['action_help'], 'description': action_params['action_help'],
'operations': operation 'operations': [operation]
}) })
for category, api_dict in resources.items(): #for category, api_dict in resources.items():
with open(os.getcwd() +'/doc/'+ category +'.json', 'w') as f: # with open(os.getcwd() +'/doc/'+ category +'.json', 'w') as f:
json.dump(api_dict, f) # json.dump(api_dict, f)
with open(os.getcwd() +'/doc/'+ resources +'.json', 'w') as f: #with open(os.getcwd() +'/doc/resources.json', 'w') as f:
json.dump(resource_list, f) # json.dump(resource_list, f)
#
print resource_list
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(main())