aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 27097c9..5d4ea1d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -80,6 +80,7 @@ use std::ffi;
use std::io;
use std::process;
use std::result;
+use std::str;
use crate::error::Error;
@@ -121,6 +122,8 @@ pub struct ExecCtx<'io> {
pub stdout: &'io mut dyn io::Write,
/// See `RunCtx::stderr`.
pub stderr: &'io mut dyn io::Write,
+ /// See `RunCtx::path`.
+ pub path: Option<ffi::OsString>,
/// See `RunCtx::admin_pin`.
pub admin_pin: Option<ffi::OsString>,
/// See `RunCtx::user_pin`.
@@ -153,6 +156,7 @@ fn handle_arguments(ctx: &mut RunCtx<'_>, args: Vec<String>) -> Result<()> {
model: args.model,
stdout: ctx.stdout,
stderr: ctx.stderr,
+ path: ctx.path.take(),
admin_pin: ctx.admin_pin.take(),
user_pin: ctx.user_pin.take(),
new_admin_pin: ctx.new_admin_pin.take(),
@@ -180,6 +184,8 @@ pub(crate) struct RunCtx<'io> {
pub stdout: &'io mut dyn io::Write,
/// The `Write` object used as standard error throughout the program.
pub stderr: &'io mut dyn io::Write,
+ /// The content of the `PATH` environment variable.
+ pub path: Option<ffi::OsString>,
/// The admin PIN, if provided through an environment variable.
pub admin_pin: Option<ffi::OsString>,
/// The user PIN, if provided through an environment variable.
@@ -217,6 +223,7 @@ fn main() {
let ctx = &mut RunCtx {
stdout: &mut stdout,
stderr: &mut stderr,
+ path: env::var_os("PATH"),
admin_pin: env::var_os(NITROCLI_ADMIN_PIN),
user_pin: env::var_os(NITROCLI_USER_PIN),
new_admin_pin: env::var_os(NITROCLI_NEW_ADMIN_PIN),