Skip to content

Commit abd556b

Browse files
committed
docs: added help usage to GXwriter/gx.py
Refs #16
1 parent 3c41710 commit abd556b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

plugins/GXWriter/gx.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,18 @@ def _encode(self):
347347
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
348348
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA""".encode())
349349

350+
__usage="""Usage: gx.py COMMAND FILE
351+
352+
Where COMMAND can be:
353+
wrap will add a basic GX header to the provided GCODE and print the result to stdout.
354+
Example: ./gx.py wrap testdata/cube.gcode > /tmp/cube.gx
355+
356+
info will print info from the GX header.
357+
Example: ./gx.py info testdata/cube.gx"""
358+
350359
if __name__ == "__main__":
351360
import sys, traceback
352-
cmd = sys.argv[1]
361+
cmd = sys.argv[1] if len(sys.argv)>1 else ""
353362
if cmd == "wrap":
354363
# Wraps the gcode file into a .gx one, output to stdout
355364
with open(sys.argv[2], 'rb') as fd:
@@ -383,5 +392,5 @@ def _encode(self):
383392
print("Right extruder filament usage:", g.filament_usage, 'mm')
384393
print("Left extruder filament usage:", g.filament_usage_left, 'mm')
385394
else:
386-
print("Unknown command ", cmd)
395+
print(__usage)
387396
sys.exit(1)

0 commit comments

Comments
 (0)