working on upgrading CLI
This commit is contained in:
parent
4e0cc858e9
commit
7318b8d664
7
modpol/interactions/console.lua
Normal file
7
modpol/interactions/console.lua
Normal 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)
|
@ -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 = ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user