moving doc directory; breaking out command line method to own file

This commit is contained in:
Adam Mayer 2017-12-08 22:22:40 -05:00
parent 57f6fa0559
commit d35839aa54
5 changed files with 36 additions and 0 deletions

36
apple410/cmdline.py Normal file
View File

@ -0,0 +1,36 @@
import sys
import argparse
def main():
parser = argparse.ArgumentParser("apple410",
description="Send a file to an Apple 410 Color Plotter.",
epilog="""
If you're having trouble sending commands to your plotter, double check
that your baud rate is in agreement with the DIP switches on the back
of your plotter and that your serial port implements hardware flow
control.
""")
parser.add_argument('-d', '--device', default='/dev/ttyUSB0',
help='The serial port that communicates with the plotter')
parser.add_argument('-b', '--baud', default=9600, type=int,
help='The baud rate of the serial port')
parser.add_argument('--svg', action='store_true',
help='Parse input as an SVG file')
parser.add_argument('FILE',
help='The file to send to the plotter. "-" will send commands from standard input.')
args = parser.parse_args()
if args.FILE == "-":
f = sys.stdin
else:
f = open(scr)
if len(sys.argv) > 1:
scr = sys.argv[1]
if args.svg:
print("SVG conversion is not yet implemented!")
sys.exit(1)
a = Apple410(args.device,baud=args.baud)
for line in f.readlines():
print("Sending {}".format(line.strip()))
a.send(line.strip())

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB