Commit 69e23def authored by Keegi's avatar Keegi

.pronsolerc support

parent 36736e31
# Sample .pronsolerc file - copy this into your home directory
!self.do_alias = lambda aarg,self=self: setattr(self,"do_"+aarg.split()[0],lambda arg,self=self,a=aarg.split(None,1)[1]:self.onecmd(" ".join((a,arg))))
alias up move Z 10
alias loud !self.loud = 1
alias quiet !self.loud = 0
...@@ -74,6 +74,13 @@ class pronsole(cmd.Cmd): ...@@ -74,6 +74,13 @@ class pronsole(cmd.Cmd):
cmd.Cmd.postloop(self) cmd.Cmd.postloop(self)
def preloop(self): def preloop(self):
try:
with open(os.path.join(os.path.expanduser("~"),".pronsolerc")) as rc:
for rc_cmd in rc:
if rc_cmd.lstrip()[0] != "#":
self.onecmd(rc_cmd.rstrip(r"\r\n"))
except IOError:
pass
print "Welcome to the printer console! Type \"help\" for a list of available commands." print "Welcome to the printer console! Type \"help\" for a list of available commands."
cmd.Cmd.preloop(self) cmd.Cmd.preloop(self)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment