add readline to client api request crafter

This commit is contained in:
Kevin Froman 2020-08-23 05:53:43 -05:00
parent 61bc5fd34b
commit 15379a7c2f
4 changed files with 37 additions and 2 deletions

View file

@ -8,7 +8,8 @@ print("Please don't run this script on Onionr networks that include more than yo
import sys
import os
os.chdir('../')
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
import onionrblocks

View file

@ -8,6 +8,19 @@ import os
if not os.path.exists('onionr.sh'):
os.chdir('../')
sys.path.append("src/")
import atexit
import readline
histfile = os.path.join(os.path.expanduser("~"), ".onionr_history")
try:
readline.read_history_file(histfile)
# default history len is -1 (infinite), which may grow unruly
readline.set_history_length(1000)
except FileNotFoundError:
pass
atexit.register(readline.write_history_file, histfile)
from onionrutils.localcommand import local_command
from onionrutils.localcommand import get_hostname
@ -16,7 +29,7 @@ try:
except TypeError:
print('Onionr not running')
sys.exit(1)
print('1. get request')
print('1. get request (default)')
print('2. post request')
choice = input(">").lower().strip()
post = False