-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
74 lines (62 loc) · 1.51 KB
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
param (
[Parameter(Mandatory=$true)]
[string]$Command,
[string]$Argument
)
$SRC_DIR = "src"
$PORT = "com9"
function send-everything {
ampy --port $PORT put $SRC_DIR /
}
function send-src {
Get-ChildItem -Path $SRC_DIR -File | ForEach-Object {
ampy --port $PORT put $($SRC_DIR + "/" + $_.Name)
}
}
function reset {
ampy --port $PORT reset --hard
}
function clean {
ampy --port $PORT ls -r | ForEach-Object {
ampy --port $PORT rm $_
}
ampy --port $PORT rm lib/primitives
ampy --port $PORT rm lib
}
function run {
send-src
reset
}
function list {
ampy --port $PORT ls -r
}
function build {
send-everything
reset
}
function get {
param (
[Parameter(Mandatory=$true)]
[string]$Filename
)
ampy --port $PORT get $Filename
}
function send {
param (
[Parameter(Mandatory=$true)]
[string]$Filename
)
ampy --port $PORT put $Filename
}
switch ($Command) {
"send-everything" { send-everything } # upload everything to pico
"send-src" { send-src } # upload only src files to pico
"reset" { reset } # reset pico
"clean" { clean } # delete all files on pico
"run" { run } # upload only src files and reset pico
"list" { list } # list all files on pico
"build" { build } # upload everything and reset pico
"get" { get $Argument } # retrieve file from pico
"send" { send $Argument } # retrieve file from pico
default { Write-Host "Check build.ps1 for available commands" }
}