blob: fdc6cb736a078b8593f93f623a932efe0aa9b8b2 (
plain)
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
|
const z = @import( "std" );
pub var server_url: []const u8 = "http://localhost:8081";
pub var server_port: u32 = 3000;
pub var api_port: u32 = 3003;
const memeql = z.mem.eql;
pub fn parse() !void {
var args = z.process.args();
var argit = args.next();
while( argit ) |arg| : (argit = args.next()) {
if( memeql( u8, arg, "--domain" ) ) {
const next = args.next();
if( next ) |domain| {
server_url = domain;
}
}
if( memeql( u8, arg, "--port" ) ) {
const next = args.next();
if( next ) |port| {
const iport = z.fmt.parseInt( u32, port, 10 ) catch 3000;
server_port = iport;
}
}
if( memeql( u8, arg, "--api-port" ) ) {
const next = args.next();
if( next ) |port| {
const iport = z.fmt.parseInt( u32, port, 10 ) catch 3000;
api_port = iport;
}
}
}
}
|