Skip to content

Commit d36a30b

Browse files
authored
Merge pull request #2 from makermelissa/master
Added reboot and file append is better
2 parents 98183be + 4dea527 commit d36a30b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

adafruit_shell.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,28 @@ def clear():
135135
"""
136136
os.system("clear")
137137

138+
@staticmethod
139+
def reboot():
140+
"""
141+
Reboot the system
142+
"""
143+
os.system("reboot")
144+
145+
@staticmethod
146+
def getcwd():
147+
"""
148+
Get the Current Working Directory
149+
"""
150+
return os.getcwd()
151+
152+
def chdir(self, directory):
153+
"""
154+
Change directory
155+
"""
156+
if directory[0] != "/" and directory[0] != ".":
157+
directory = self.getcwd() + "/" + directory
158+
return os.chdir(directory)
159+
138160
@staticmethod
139161
def is_root():
140162
"""
@@ -158,6 +180,7 @@ def write_text_file(path, content, append=True):
158180
"""
159181
if append:
160182
mode = "a"
183+
content = "\n" + content
161184
else:
162185
mode = "w"
163186
service_file = open(path, mode)

0 commit comments

Comments
 (0)