handle args
This commit is contained in:
@@ -1,9 +1,15 @@
|
||||
package hanabi
|
||||
|
||||
import "core:fmt"
|
||||
import "core:net"
|
||||
import "core:os"
|
||||
|
||||
main :: proc() {
|
||||
if (len(os.args) == 1 || len(os.args) > 2) {
|
||||
panic("usage: <addr:ip>")
|
||||
}
|
||||
|
||||
sock, dial_err := net.dial_tcp(os.args[1])
|
||||
if dial_err != nil do panic(fmt.tprintln("failed to dial", os.args[1]))
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -32,14 +32,12 @@ create_comm_world :: proc(addresses: []string) -> (comm: Comm_World) {
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
game := create_game(8, 3, 3)
|
||||
print_game(game)
|
||||
|
||||
if len(os.args) > 1 {
|
||||
comm := create_comm_world(os.args[1:])
|
||||
fmt.println(comm.sockets)
|
||||
} else {
|
||||
fmt.eprintln("usage: <player 1 addr:port> <p2> [p3] [p4] [p5]")
|
||||
if len(os.args) == 1 {
|
||||
panic(fmt.tprintln("usage: <player 1 addr:port> <p2> [p3] [p4] [p5]"))
|
||||
}
|
||||
game := create_game(8, 3, u8(len(os.args) - 1))
|
||||
print_game(game)
|
||||
comm := create_comm_world(os.args[1:])
|
||||
fmt.println(comm.sockets)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user