working on upgrading CLI

This commit is contained in:
Luke Miller 2021-07-04 23:54:54 -04:00
parent 4e0cc858e9
commit 7318b8d664
2 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,7 @@
dofile("../modpol.lua")
print("Log in as which user?")
local username = io.read()
local org = modpol.dashboard(username)
modpol.interactions.org_dashboard(username, org)

View File

@ -15,16 +15,17 @@ modpol.interactions = {}
-- Output: Displays a menu of commands to the user
-- TKTK currently just prints all of modpol---needs major improvement
function modpol.dashboard(user)
local output = ""
-- Org status
output = output .. "Orgs:\n" ..
table.concat(modpol.orgs.list_all(),"\n")
-- Command list (should be redone to be org-specific)
output = output .. "\nCommand list:\n"
for key,value in pairs(modpol) do
output = output .. "modpol." .. key .. " "
print()
local user_orgs = modpol.orgs.user_orgs(user)
print('Select an org')
for i, org in ipairs(user_orgs) do
print('['..i..']'..' '..org)
end
print(output)
local sel = io.read()
return user_orgs[tonumber(sel)]
end
@ -32,8 +33,10 @@ end
-- Params: user (string), org_name (string)
-- Output: Displays a menu of org-specific commands to the user
function modpol.interactions.org_dashboard(user, org_name)
print()
local org = modpol.orgs.get_org(org_name)
if not org then return nil end
local is_member = org:has_member(user)
local membership_toggle = function()
local toggle_code = ""