Skip to content

Commit 24dfd87

Browse files
sago35deadprogram
authored andcommitted
sdcard: add write functionality to examples/sdcard/tinyfs
1 parent a748451 commit 24dfd87

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

examples/sdcard/tinyfs/console/console.go

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var (
3535
commands = map[string]cmdfunc{
3636
"": noop,
3737
"dbg": dbg,
38+
"help": help,
3839
"lsblk": lsblk,
3940
"mount": mount,
4041
"umount": umount,
@@ -160,6 +161,28 @@ func runCommand(line string) {
160161

161162
func noop(argv []string) {}
162163

164+
func help(argv []string) {
165+
fmt.Printf("help\r\n")
166+
fmt.Printf(" show help\r\n")
167+
fmt.Printf("dbg\r\n")
168+
fmt.Printf(" toggle debug mode\r\n")
169+
fmt.Printf("xxd <hex address, ex: 0xA0> <size of hexdump in bytes>\r\n")
170+
fmt.Printf(" hexdump the specified address\r\n")
171+
fmt.Printf("ls <target file>\r\n")
172+
fmt.Printf(" list information\r\n")
173+
fmt.Printf("samples\r\n")
174+
fmt.Printf(" write some files in the root directory\r\n")
175+
fmt.Printf("mkdir <target dir>\r\n")
176+
fmt.Printf(" create directory\r\n")
177+
fmt.Printf("cat <target file>\r\n")
178+
fmt.Printf(" print the contents of file\r\n")
179+
fmt.Printf("create <target file>\r\n")
180+
fmt.Printf(" create file\r\n")
181+
fmt.Printf("write <target file>\r\n")
182+
fmt.Printf(" write to file (press CTRL-D to exit)\r\n")
183+
fmt.Printf("rm\r\n")
184+
}
185+
163186
func dbg(argv []string) {
164187
if debug {
165188
debug = false
@@ -421,7 +444,7 @@ func cat(argv []string) {
421444
println("Trying to cat to " + tgt)
422445
}
423446
if tgt == "" {
424-
println("Usage: cat <target dir>")
447+
println("Usage: cat <target file>")
425448
return
426449
}
427450
if debug {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ go 1.15
55
require (
66
github.com/eclipse/paho.mqtt.golang v1.2.0
77
github.com/frankban/quicktest v1.10.2
8-
github.com/tinygo-org/tinyfs v0.0.0-20210514090915-924e60a7bcf8
8+
github.com/tinygo-org/tinyfs v0.0.0-20210620184125-5b00ebcf68bb
99
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ github.com/tinygo-org/tinyfs v0.0.0-20210514004344-b02c062d12c9 h1:66or7MohOph3x
1313
github.com/tinygo-org/tinyfs v0.0.0-20210514004344-b02c062d12c9/go.mod h1:HGuyo42bGd1zWSuS1gwgyyjN36ZZMlEpwM0vSrglmXc=
1414
github.com/tinygo-org/tinyfs v0.0.0-20210514090915-924e60a7bcf8 h1:pYwuKe1XuNeJnGV1UjeZ0FhuZ5+lapIq1NUmGacbBwo=
1515
github.com/tinygo-org/tinyfs v0.0.0-20210514090915-924e60a7bcf8/go.mod h1:HGuyo42bGd1zWSuS1gwgyyjN36ZZMlEpwM0vSrglmXc=
16+
github.com/tinygo-org/tinyfs v0.0.0-20210620184125-5b00ebcf68bb h1:lgwaY6CLUvZoH4DMwHn3vKjYRx6npRX1FwjWuJEpZao=
17+
github.com/tinygo-org/tinyfs v0.0.0-20210620184125-5b00ebcf68bb/go.mod h1:HGuyo42bGd1zWSuS1gwgyyjN36ZZMlEpwM0vSrglmXc=
1618
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
1719
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
1820
tinygo.org/x/drivers v0.16.0/go.mod h1:uT2svMq3EpBZpKkGO+NQHjxjGf1f42ra4OnMMwQL2aI=

0 commit comments

Comments
 (0)