posting
quadrismegistus 4 years ago
parent c372b9db6a
commit 254f0a821a

@ -12,7 +12,7 @@ path=`realpath "$SCRIPTPATH/../komrade/app/main.py"`
pathvenv=`realpath "$SCRIPTPATH/../venv/bin/activate"`
source $pathvenv
python "$path"
python "$path" $*
if command -v deactivate &> /dev/null

@ -9,7 +9,7 @@ path=`realpath "$SCRIPTPATH/../komrade/cli/cli.py"`
pathvenv=`realpath "$SCRIPTPATH/../venv/bin/activate"`
source $pathvenv
python "$path"
python "$path" $*
if command -v deactivate &> /dev/null

@ -10,7 +10,7 @@ pathvenv=`realpath "$SCRIPTPATH/../venv/bin/activate"`
source $pathvenv
cmd="python $path 8080"
cmd="python $path 8080 $*"
# do forever
while true; do $cmd && break; done

@ -75,7 +75,7 @@ class Operator(Keymaker):
# add to phonebook
if name: PHONEBOOK[name]=self
if self.pubkey: PHONEBOOK[self.pubkey.data_b64]
if self.pubkey: PHONEBOOK[self.pubkey.data_b64]=self
@property

@ -7,6 +7,7 @@ HELPSTR = """
/login [name] --> log back in
/register [name] --> new komrade
/meet [name] --> exchange info
/msg [name] [msg] --> write to person or group
/who [name] --> show contact info
/help --> seek help
"""
@ -17,7 +18,8 @@ class CLI(Logger):
'register':'join the komrades',
'login':'log back in',
'meet':'meet a komrade',
'who':'show contacts or info'
'who':'show contacts or info',
'msg':'write people'
}
def __init__(self,name='',cmd='',persona=None):
@ -130,6 +132,16 @@ class CLI(Logger):
# meet?
self.komrade.meet(name)
def msg(self,dat):
name_or_pubkey,msg = dat.split(' ',1)
self.log(f'Composed msg to {name_or_pubkey}: {msg}')
msg_obj = self.komrade.msg(
name_or_pubkey,
msg
)
self.log(f'Sent msg obj to {name_or_pubkey}: {msg_obj}')
@ -452,12 +464,13 @@ class CLI(Logger):
def run_cli():
def run_cli(inp):
cli = CLI()
cli.run() #'/register elon') #'/register',name='elon')
cli.run(inp) #'/register elon') #'/register',name='elon')
if __name__=='__main__':
run_cli()
inp = ' '.join(sys.argv[1:])
run_cli(inp)
# asyncio.run(test_async())

Loading…
Cancel
Save