forked from Apple-2-HW/Apple2-IO-RPi
Allow force lower case commands (Issue #15)
This commit is contained in:
parent
18c25108b3
commit
1b184a9b5a
@ -9,6 +9,8 @@ import (
|
||||
"github.com/tjboldt/Apple2-IO-RPi/RaspberryPi/apple2driver/a2io"
|
||||
)
|
||||
|
||||
var forceLowercase = false
|
||||
|
||||
func ExecCommand() {
|
||||
workingDirectory, err := os.Getwd()
|
||||
if err != nil {
|
||||
@ -18,6 +20,9 @@ func ExecCommand() {
|
||||
|
||||
fmt.Printf("Reading command to execute...\n")
|
||||
linuxCommand, err := a2io.ReadString()
|
||||
if forceLowercase {
|
||||
linuxCommand = strings.ToLower(linuxCommand)
|
||||
}
|
||||
fmt.Printf("Command to run: %s\n", linuxCommand)
|
||||
if strings.HasPrefix(linuxCommand, "cd ") {
|
||||
workingDirectory = strings.Replace(linuxCommand, "cd ", "", 1)
|
||||
@ -39,9 +44,13 @@ func ExecCommand() {
|
||||
"Built-in commands:\r" +
|
||||
"a2help - display this message\r" +
|
||||
"a2wifi - set up wifi\r" +
|
||||
"A2LOWER - force lowercase for II+\r" +
|
||||
"\r")
|
||||
return
|
||||
}
|
||||
if linuxCommand == "A2LOWER" {
|
||||
forceLowercase = true
|
||||
}
|
||||
if linuxCommand == "a2wifi" {
|
||||
a2io.WriteString("\r" +
|
||||
"Usage: a2wifi list\r" +
|
||||
@ -54,7 +63,7 @@ func ExecCommand() {
|
||||
}
|
||||
if strings.HasPrefix(linuxCommand, "a2wifi select") {
|
||||
params := strings.Fields(linuxCommand)
|
||||
if (len(params) != 4) {
|
||||
if len(params) != 4 {
|
||||
a2io.WriteString("\rIncorrect number of parameters. Usage: a2wifi select SSID PASSWORD\r\r")
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user