2022-11-03 23:47:50 +00:00
|
|
|
from src.fw_api import select_instance
|
2022-11-01 10:15:28 +00:00
|
|
|
from src.fw_radios import list_radios
|
2022-11-03 23:47:50 +00:00
|
|
|
import json
|
2022-11-02 00:05:08 +00:00
|
|
|
from loguru import logger
|
2022-11-01 10:15:28 +00:00
|
|
|
from pyfzf.pyfzf import FzfPrompt
|
|
|
|
|
|
|
|
fzf = FzfPrompt()
|
|
|
|
|
|
|
|
def main():
|
2022-11-02 00:05:08 +00:00
|
|
|
logger.remove()
|
2022-11-01 10:15:28 +00:00
|
|
|
while True:
|
2022-11-03 23:45:40 +00:00
|
|
|
menu = ('Radios', 'Switch instance' )
|
2022-11-01 10:15:28 +00:00
|
|
|
ids = fzf.prompt(menu)
|
|
|
|
|
|
|
|
selected = ids[0]
|
|
|
|
if selected == 'Radios':
|
|
|
|
list_radios()
|
2022-11-03 23:45:40 +00:00
|
|
|
if selected == 'Switch instance':
|
|
|
|
with open('config.json', 'rt') as f:
|
|
|
|
conf = json.loads(f.read())
|
|
|
|
list_instances = conf.get('public_list_instances')
|
|
|
|
instance = fzf.prompt(list_instances, '--header \'Select instance\'')[0]
|
|
|
|
select_instance(instance)
|
2022-11-01 10:15:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|