Number of CLI arguments. Index 0 is the program path; user args start at 1, mirroring C's argc.
for let i: int = 0; i < env_args_count(); i++ {
println!(i, env_args_at(i));
}
defined in C:\Users\bye45\.glide\bin/src/stdlib/env.glide
Number of CLI arguments. Index `0` is the program path; user args
Number of CLI arguments. Index 0 is the program path; user args start at 1, mirroring C's argc.
for let i: int = 0; i < env_args_count(); i++ {
println!(i, env_args_at(i));
}
CLI argument at index i. Returns "" for out-of-range indices.
let prog: string = env_args_at(0); // program path
let first: string = env_args_at(1); // first user arg, "" if missing
All user-supplied CLI args as a Vector<string>, skipping the program path at index 0.
let args: *Vector<string> = env_args();
for let i: int = 0; i < args.len(); i++ { println!(args.get(i)); }
Look up environment variable name. Returns "" when unset. Use env_has if you need to distinguish "unset" from "empty value".
let path: string = env_get("PATH");
let dirs: *Vector<string> = path.split(os_path_list_sep());
true if the variable is set with a non-empty value.
if env_has("DEBUG") { println!("verbose mode on"); }
Terminate the process with code. Skips Glide-side cleanup — defer blocks and auto-drops in higher stack frames will NOT run.
if !cfg.ok { eprintln(cfg.err); env_exit(1); }
Set environment variable name to value. Overwrites any existing value. Returns Err if the OS rejects the call (very rare — typically a name with = in it, or a system-level limit).
let r: ! = env_set("LANG", "en_US.UTF-8");
if !r.ok { eprintln(r.err); }
env_get("LANG"); // "en_US.UTF-8"
Remove environment variable name. Idempotent — calling on an unset var is not an error.
env_unset("DEBUG");
env_has("DEBUG"); // false
One entry of the process environment, decomposed into key and value. Returned by env_all().
Snapshot of the entire process environment. The list is taken at call time and is a copy — mutating env via env_set / env_unset after this call does NOT update the returned vector.
let all: *Vector<EnvKV> = env_all();
for let i: int = 0; i < all.len(); i++ {
let kv: EnvKV = all.get(i);
println!(kv.key, "=", kv.value);
}
Expand $VAR, ${VAR} and %VAR% references in s to their current env values. Unknown vars expand to empty string. Literal $ followed by a non-name character (or %X without closing %) is preserved.
env_expand("home is $HOME"); // POSIX style
env_expand("home is ${HOME}/cache"); // POSIX braces
env_expand("data: %APPDATA%\\app"); // Windows style