Skip to content

Commit 071781c

Browse files
committed
Define more varsets.
1 parent 678d8f1 commit 071781c

26 files changed

+263
-49
lines changed

lib/getenv/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
mod features;
1313
pub use features::*;
1414

15-
#[cfg(feature = "std")]
16-
pub mod vars;
15+
mod vars;
16+
pub use vars::*;
17+
18+
mod varsets;
19+
pub use varsets::*;
1720

1821
#[doc = include_str!("../../../README.md")]
1922
#[cfg(doctest)]

lib/getenv/src/vars.rs

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,5 @@
11
// This is free and unencumbered software released into the public domain.
22

3-
pub mod cargo;
4-
pub use cargo::*;
5-
6-
pub mod conda;
7-
pub use conda::*;
8-
9-
pub mod git;
10-
pub use git::*;
11-
12-
pub mod macos;
13-
pub use macos::*;
14-
15-
pub mod openssl;
16-
pub use openssl::*;
17-
18-
pub mod posix;
19-
pub use posix::*;
20-
21-
pub mod python;
22-
pub use python::*;
23-
24-
pub mod ruby;
25-
pub use ruby::*;
26-
27-
pub mod windows;
28-
pub use windows::*;
29-
30-
pub mod xdg;
31-
pub use xdg::*;
32-
333
#[cfg(feature = "std")]
344
pub fn var(key: impl AsRef<std::ffi::OsStr>) -> Option<String> {
355
use std::env::VarError::*;

lib/getenv/src/vars/windows.rs

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/getenv/src/varsets.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// This is free and unencumbered software released into the public domain.
2+
3+
pub mod aws;
4+
pub use aws::*;
5+
6+
pub mod cargo;
7+
pub use cargo::*;
8+
9+
pub mod conda;
10+
pub use conda::*;
11+
12+
pub mod cuda;
13+
pub use cuda::*;
14+
15+
pub mod docker;
16+
pub use docker::*;
17+
18+
pub mod git;
19+
pub use git::*;
20+
21+
pub mod go;
22+
pub use go::*;
23+
24+
pub mod homebrew;
25+
pub use homebrew::*;
26+
27+
pub mod java;
28+
pub use java::*;
29+
30+
pub mod locale;
31+
pub use locale::*;
32+
33+
pub mod macos;
34+
pub use macos::*;
35+
36+
pub mod near;
37+
pub use near::*;
38+
39+
pub mod node;
40+
pub use node::*;
41+
42+
pub mod openssl;
43+
pub use openssl::*;
44+
45+
pub mod posix;
46+
pub use posix::*;
47+
48+
pub mod proxy;
49+
pub use proxy::*;
50+
51+
pub mod python;
52+
pub use python::*;
53+
54+
pub mod ruby;
55+
pub use ruby::*;
56+
57+
pub mod rust;
58+
pub use rust::*;
59+
60+
pub mod ssh;
61+
pub use ssh::*;
62+
63+
pub mod windows;
64+
pub use windows::*;
65+
66+
pub mod xdg;
67+
pub use xdg::*;

lib/getenv/src/varsets/aws.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// This is free and unencumbered software released into the public domain.
2+
3+
use crate::var;
4+
5+
/// See: https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html
6+
pub fn aws_access_key_id() -> Option<String> {
7+
var("AWS_ACCESS_KEY_ID")
8+
}
9+
10+
/// See: https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html
11+
pub fn aws_default_region() -> Option<String> {
12+
var("AWS_DEFAULT_REGION")
13+
}
14+
15+
/// See: https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-envvars.html
16+
pub fn aws_secret_access_key() -> Option<String> {
17+
var("AWS_SECRET_ACCESS_KEY")
18+
}

lib/getenv/src/vars/cargo.rs renamed to lib/getenv/src/varsets/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This is free and unencumbered software released into the public domain.
22

3-
use super::var;
3+
use crate::var;
44

55
/// See: https://doc.rust-lang.org/cargo/reference/environment-variables.html
66
pub fn cargo() -> Option<String> {

lib/getenv/src/vars/conda.rs renamed to lib/getenv/src/varsets/conda.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This is free and unencumbered software released into the public domain.
22

3-
use super::var;
3+
use crate::var;
44

55
pub fn conda() -> Option<String> {
66
var("CONDA")

lib/getenv/src/varsets/cuda.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This is free and unencumbered software released into the public domain.
2+
3+
use crate::var;
4+
5+
/// See: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
6+
pub fn cuda_cache_disable() -> Option<bool> {
7+
var("CUDA_CACHE_DISABLE").map(|s| s == "1")
8+
}

lib/getenv/src/varsets/docker.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// This is free and unencumbered software released into the public domain.
2+
3+
use crate::var;
4+
5+
/// See: https://docs.docker.com/reference/cli/docker/
6+
pub fn docker_host() -> Option<String> {
7+
var("DOCKER_HOST")
8+
}

lib/getenv/src/vars/git.rs renamed to lib/getenv/src/varsets/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This is free and unencumbered software released into the public domain.
22

3-
use super::var;
3+
use crate::var;
44

55
/// See: https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables
66
pub fn git() -> Option<String> {

0 commit comments

Comments
 (0)