summaryrefslogtreecommitdiff
path: root/tools/wasptool
diff options
context:
space:
mode:
Diffstat (limited to 'tools/wasptool')
-rwxr-xr-xtools/wasptool23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/wasptool b/tools/wasptool
index 34fc97d..d611735 100755
--- a/tools/wasptool
+++ b/tools/wasptool
@@ -46,7 +46,7 @@ def unsync(c):
c.expect('Watch is running, use Ctrl-C to stop')
c.send('\x18')
-def paste(c, f, verbose=False):
+def paste(c, f, verbose=False, chunk=None):
docstring = False
tosend = []
@@ -66,11 +66,17 @@ def paste(c, f, verbose=False):
if ln.lstrip().startswith('#'):
continue
+ if ln.strip() == '':
+ continue
+
tosend.append(ln)
for ln in pbar(tosend, verbose):
- c.sendline(ln)
- c.expect('=== ')
+ if chunk and ln.startswith('class'):
+ chunk()
+
+ c.sendline(ln)
+ c.expect('=== ')
def handle_eval(c, cmd):
verbose = bool(c.logfile)
@@ -89,6 +95,15 @@ def handle_eval(c, cmd):
def handle_exec(c, fname):
verbose = bool(c.logfile)
+ def chunk():
+ c.logfile = sys.stdout
+ c.send('\x04')
+ c.expect('>>> ')
+ if not verbose:
+ c.logfile = None
+ c.send('\x05')
+ c.expect('=== ')
+
with open(fname) as f:
if not verbose:
print(f'Preparing to run {fname}:')
@@ -96,7 +111,7 @@ def handle_exec(c, fname):
c.send('\x05')
c.expect('=== ')
- paste(c, f, verbose)
+ paste(c, f, verbose, chunk)
c.logfile = sys.stdout
c.send('\x04')