Skip to content
This repository has been archived by the owner on Jan 14, 2020. It is now read-only.

Commit

Permalink
Adding documentation in code
Browse files Browse the repository at this point in the history
  • Loading branch information
ZacBlanco committed Jun 16, 2016
1 parent 6502cfc commit f6feccf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/shell.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
import os, subprocess

# The shell class defines just a few functions which can make executing commands easier
# run
# This command has two possible ways to be called
# (command) which is just a single line with all arguments
# (command, args) which simply just joins a string with the command and arguments
#
# It is also possible to change the current working directory (cwd)
# for commands which are sensitive to file locations
# (Unfortunately 'cd' doesn't work)

# If no arguments are passed for args, then it is assumed to be a string of length 0
# If no arguments are passed to the constructor we assume default cwd

class Shell:

cwd = ''
Expand All @@ -20,6 +33,7 @@ def run(self, command, args=''):

# set_cwd
# equivalent to doing a 'cd' command at the command line
# Error if the directory doesn't exist
def set_cwd(self, new_cwd):
if not os.path.exists(new_cwd):
raise IOError(' '.join([self.cwd, 'does not exist']))
Expand Down

0 comments on commit f6feccf

Please sign in to comment.