Skip to content

Commit aa243c7

Browse files
author
Jonathan Como
committed
Docs for sh
1 parent b75a9de commit aa243c7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,24 +112,24 @@ snake build:tools [typ=core] # Builds the application
112112

113113
## API Reference
114114

115-
### `@task(requires=None)`
115+
#### `@task(requires=None)`
116116

117117
Decorates a function that then exposes it as a task to be run.
118118
The name of the function becomes the name of the task.
119119
The `requires` parameter, if specified, is a list of strings where each string is the name of a task that this one depends on.
120120

121-
### `@namespace`
121+
#### `@namespace`
122122

123123
Decorates a function so that it exposes a task namespace.
124124
The name of the function becomes the name of the namespace.
125125
Tasks and nested namespaces can be defined in the namespace and will be called as `namespace:task`.
126126

127-
### `sh(command, silent=False)`
127+
#### `sh(command, silent=False)`
128128

129129
Runs a shell command.
130130
If silent is not specified, an exception will be raised if the resulting status of the command is nonzero.
131131

132-
### `ENV`
132+
#### `ENV`
133133

134134
A dict that gives you access to environment variables.
135135
It has a special property that accessing by key using brackets will not raise a `KeyError` but will return `None` instead.

snake/shell.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ def __init__(self, logger):
1616
self.logger = logger
1717

1818
def execute(self, command, silent=False):
19+
"""Executes a command using the user's shell. A nonzero exit status will raise an exception unless
20+
silent is specified.
21+
22+
:param command: the command to run as a string
23+
:param silent: if false, will raise if the command fails
24+
25+
:return: the exit status of the command
26+
"""
1927
self.logger.info(command)
2028
exit_status = call(command, shell=True)
2129
if exit_status != 0 and not silent:

0 commit comments

Comments
 (0)