mirror of
https://github.com/ivanizag/izapple2.git
synced 2025-01-10 12:30:17 +00:00
Check key range
This commit is contained in:
parent
d85e22cc0a
commit
1777954a54
@ -70,10 +70,13 @@ func main() {
|
|||||||
case "key":
|
case "key":
|
||||||
if len(parts) < 2 {
|
if len(parts) < 2 {
|
||||||
fmt.Println("Usage: key <number>")
|
fmt.Println("Usage: key <number>")
|
||||||
} else if code, err := strconv.Atoi(parts[1]); err != nil {
|
|
||||||
fmt.Println("Usage: key <number>")
|
|
||||||
} else {
|
} else {
|
||||||
fe.putKey(uint8(code))
|
code, err := strconv.Atoi(parts[1])
|
||||||
|
if err != nil || code < 0 || code > 127 {
|
||||||
|
fmt.Println("Usage: key <number from 0 to 127>")
|
||||||
|
} else {
|
||||||
|
fe.putKey(uint8(code))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case "type":
|
case "type":
|
||||||
text := strings.Join(parts[1:], " ")
|
text := strings.Join(parts[1:], " ")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user