minor update
This commit is contained in:
parent
e66b1bd3b2
commit
f2065240b4
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
Copyright (c) 2022 Zsombor Barna
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
19
admin
19
admin
|
@ -33,9 +33,22 @@ def compose(id):
|
|||
print("".join(authorized_set))
|
||||
|
||||
|
||||
def add(id):
|
||||
with open(workdir/Path(id),mode='a') as f:
|
||||
for key in keys:
|
||||
print(key, file=f)
|
||||
print(key, "added to", id)
|
||||
|
||||
def remove(id):
|
||||
for key in keys:
|
||||
run(['sed','-i',f'/.*{key}.*/d',str(workdir/Path(id))])
|
||||
print(key, "removed from", id)
|
||||
|
||||
operations = {"push": push,
|
||||
"pull": pull,
|
||||
"compose": compose}
|
||||
"compose": compose,
|
||||
"add": add,
|
||||
"remove": remove}
|
||||
|
||||
|
||||
def construct_predicate(id_list, group_list):
|
||||
|
@ -71,12 +84,14 @@ def execute(operation, predicate):
|
|||
parser = ArgumentParser()
|
||||
parser.add_argument('-H', '--host', action='append')
|
||||
parser.add_argument('-g', '--group', action='append')
|
||||
parser.add_argument('-o', '--operation', choices=['pull', 'push', 'compose'])
|
||||
parser.add_argument('-o', '--operation', choices=['pull', 'push', 'compose', 'add', 'remove'])
|
||||
parser.add_argument('-k', '--key', action='append')
|
||||
args = parser.parse_args(argv[1:])
|
||||
|
||||
id_list = list() if args.host is None else args.host
|
||||
group_list = list() if args.group is None else args.group
|
||||
operation = operations[args.operation]
|
||||
keys = args.key
|
||||
|
||||
if(operation == "push"):
|
||||
# collect local public keys
|
||||
|
|
Loading…
Reference in New Issue