Reorganize repo: move scripts to contrib/scripts/, clean up .gitignore, untrack backup files
This commit is contained in:
24
contrib/scripts/listassetchainparams
Executable file
24
contrib/scripts/listassetchainparams
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python2
|
||||
import os
|
||||
import json
|
||||
|
||||
def format_param(param, value):
|
||||
return '-' + param + '=' + value
|
||||
|
||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
# Look for assetchains.json in same dir first, then in src/
|
||||
json_path = os.path.join(script_dir, 'assetchains.json')
|
||||
if not os.path.exists(json_path):
|
||||
json_path = os.path.join(script_dir, '..', '..', 'src', 'assetchains.json')
|
||||
with open(json_path) as file:
|
||||
assetchains = json.load(file)
|
||||
|
||||
for chain in assetchains:
|
||||
params = []
|
||||
for param, value in chain.items():
|
||||
if isinstance(value, list):
|
||||
for dupe_value in value:
|
||||
params.append(format_param(param, dupe_value))
|
||||
else:
|
||||
params.append(format_param(param, value))
|
||||
print(' '.join(params))
|
||||
Reference in New Issue
Block a user