Skip to content

Commit 0ce36ff

Browse files
committed
chore: comment some functions
1 parent e3f818e commit 0ce36ff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/variables.rs

+4
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ use std::{env, io::stdout};
22

33
use crate::utils::*;
44

5+
/// Print all environment variables
56
pub fn print_env() {
67
print_list_as_variables(&mut stdout(), env::vars().collect());
78
}
89

10+
/// Print list of variables as key-value pairs
911
fn print_list_as_variables(writer: &mut dyn std::io::Write, variables: Vec<(String, String)>) {
1012
for (key, value) in variables {
1113
writeln!(writer, "{} = \"{}\"", key, value).expect("can't write to buffer");
1214
}
1315
}
1416

17+
/// Set variable with given key and value
1518
pub fn set_variable(key: &str, value: &str, global: bool, process: Option<String>) -> Result<(), String> {
1619
if global {
1720
if let Err(err) = globalenv::set_var(key, value) {
@@ -32,6 +35,7 @@ pub fn set_variable(key: &str, value: &str, global: bool, process: Option<String
3235
Ok(())
3336
}
3437

38+
/// Delete variable with given name
3539
pub fn delete_variable(name: String, global: bool) -> Result<(), String> {
3640
if global {
3741
if let Err(err) = globalenv::unset_var(&name) {

0 commit comments

Comments
 (0)