forked from indymedia/epicyon
Commandline options for setting roles and skills
parent
21fbfa3b3b
commit
796f9d6ac5
38
epicyon.py
38
epicyon.py
|
@ -173,6 +173,14 @@ parser.add_argument("-c","--client", type=str2bool, nargs='?', \
|
||||||
help="Use as an ActivityPub client")
|
help="Use as an ActivityPub client")
|
||||||
parser.add_argument('--maxreplies', dest='maxReplies', type=int,default=64, \
|
parser.add_argument('--maxreplies', dest='maxReplies', type=int,default=64, \
|
||||||
help='Maximum number of replies to a post')
|
help='Maximum number of replies to a post')
|
||||||
|
parser.add_argument('--role', dest='role', type=str,default=None, \
|
||||||
|
help='Set a role for a person')
|
||||||
|
parser.add_argument('--organization','--project', dest='project', type=str,default=None, \
|
||||||
|
help='Set a project for a person')
|
||||||
|
parser.add_argument('--skill', dest='skill', type=str,default=None, \
|
||||||
|
help='Set a skill for a person')
|
||||||
|
parser.add_argument('--level', dest='skillLevelPercent', type=int,default=None, \
|
||||||
|
help='Set a skill level for a person as a percentage, or zero to remove')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
debug=False
|
debug=False
|
||||||
|
@ -527,7 +535,35 @@ if args.backgroundImage:
|
||||||
else:
|
else:
|
||||||
print('Background image was not added for '+args.nickname)
|
print('Background image was not added for '+args.nickname)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
if args.project:
|
||||||
|
if not nickname:
|
||||||
|
print('No nickname given')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if args.role.lower()=='none' or \
|
||||||
|
args.role.lower()=='remove' or \
|
||||||
|
args.role.lower()=='delete':
|
||||||
|
args.role=None
|
||||||
|
if args.role:
|
||||||
|
if setRole(baseDir,nickname,domain,args.project,args.role):
|
||||||
|
print('Role within '+args.project+' set to '+args.role)
|
||||||
|
else:
|
||||||
|
if setRole(baseDir,nickname,domain,args.project,None):
|
||||||
|
print('Left '+args.project)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
if args.skill:
|
||||||
|
if args.skillLevelPercent==0:
|
||||||
|
args.skillLevelPercent=None
|
||||||
|
if args.skillLevelPercent:
|
||||||
|
if setSkillLevel(baseDir,nickname,domain,args.skill,args.skillLevelPercent):
|
||||||
|
print('Skill level for '+args.skill+' set to '+str(args.skillLevelPercent)+'%')
|
||||||
|
else:
|
||||||
|
if setSkillLevel(baseDir,nickname,domain,args.skill,args.skillLevelPercent):
|
||||||
|
print('Skill '+args.skill+' removed')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
if federationList:
|
if federationList:
|
||||||
print('Federating with: '+str(federationList))
|
print('Federating with: '+str(federationList))
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import commentjson
|
||||||
import os
|
import os
|
||||||
import fileinput
|
import fileinput
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from pprint import pprint
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
@ -97,6 +98,8 @@ def setSkillLevel(baseDir: str,nickname: str,domain: str, \
|
||||||
return False
|
return False
|
||||||
with open(actorFilename, 'r') as fp:
|
with open(actorFilename, 'r') as fp:
|
||||||
actorJson=commentjson.load(fp)
|
actorJson=commentjson.load(fp)
|
||||||
|
if not actorJson.get('skills'):
|
||||||
|
actorJson['skills']={}
|
||||||
if skillLevelPercent>0:
|
if skillLevelPercent>0:
|
||||||
actorJson['skills'][skill]=skillLevelPercent
|
actorJson['skills'][skill]=skillLevelPercent
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue