Skip to content

Commit 05afce7

Browse files
committed
Add hands-on structrure
1 parent d60edd4 commit 05afce7

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/architecture/hands-on-structure.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,51 @@ title: Hands-on Structure
33
parent: Architecture
44
nav_order: 1
55
---
6+
7+
All hands-ons are stored within the `hands_on` folder of the [`exercises`](https://github.com/git-mastery/exercises).
8+
9+
They are represented by a single Python file, whose name is the hands-on ID (replacing `_` with `-`).
10+
11+
Hands-ons are not graded and the progress is not tracked. They are only present to help setup the student's folder structure for a given lesson!
12+
13+
{: .note }
14+
15+
Git-Mastery users will prefix `hp-` before the hands-on names, but internally, we do not use this prefix as the `hands_on` folder is sufficient for us.
16+
17+
## File structure
18+
19+
Since the hands-on is only comprised of a single file, there isn't a lot of complexity to it.
20+
21+
```python
22+
import subprocess
23+
from sys import exit
24+
from typing import List, Optional
25+
26+
__requires_git__ = True
27+
__requires_github__ = True
28+
29+
30+
def run_command(command: List[str], verbose: bool) -> Optional[str]:
31+
try:
32+
result = subprocess.run(
33+
command,
34+
capture_output=True,
35+
text=True,
36+
check=True,
37+
)
38+
if verbose:
39+
print(result.stdout)
40+
return result.stdout
41+
except subprocess.CalledProcessError as e:
42+
if verbose:
43+
print(e.stderr)
44+
exit(1)
45+
46+
47+
def download(verbose: bool):
48+
pass
49+
```
50+
51+
The setup instructions of the hands-on go under `download`.
52+
53+
`__requires_git__` and `__requires_github__` tells the Git-Mastery app whether to run automatic verification that the student has already setup Git and/or Github CLI correctly!

0 commit comments

Comments
 (0)