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