* add llamacpp plugin * Refactor llamacpp plugin * add utils plugin * remove utils folder * add hardware implementation * add utils folder + move utils function * organize cargo files * refactor utils src * refactor util * apply fmt * fmt * Update gguf + reformat * add permission for gguf commands * fix cargo test windows * revert yarn lock * remove cargo.lock for hardware plugin * ignore cargo.lock file * Fix hardware invoke + refactor hardware + refactor tests, constants * use api wrapper in extension to invoke hardware call + api wrapper build integration * add newline at EOF (per Akarshan) * add vi mock for getSystemInfo
21 lines
649 B
Rust
21 lines
649 B
Rust
/// Extracts the value of a command line argument flag from args vector
|
|
pub fn extract_arg_value(args: &[String], flag: &str) -> String {
|
|
args.iter()
|
|
.position(|arg| arg == flag)
|
|
.and_then(|i| args.get(i + 1))
|
|
.cloned()
|
|
.unwrap_or_default()
|
|
}
|
|
|
|
/// Parses port from command line arguments with fallback to default (8080)
|
|
pub fn parse_port_from_args(args: &[String]) -> i32 {
|
|
let port_str = extract_arg_value(args, "--port");
|
|
match port_str.parse() {
|
|
Ok(p) => p,
|
|
Err(_) => {
|
|
eprintln!("Invalid port value: '{}', using default 8080", port_str);
|
|
8080
|
|
}
|
|
}
|
|
}
|