Require Environment to be ShellInterface

This commit is contained in:
Leonard Steppy 2025-02-07 14:08:38 +01:00
parent a324935005
commit 1230a3ea07
2 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ use std::ffi::{OsStr, OsString};
use std::path::PathBuf;
use std::{env, io};
pub trait Environment {
pub trait Environment: ShellInterface {
fn args_os(&self) -> Vec<OsString>;
fn var<K>(&self, key: K) -> Result<String, VarError>
where

View File

@ -1,13 +1,13 @@
mod action;
mod environment;
mod file;
#[cfg(test)]
mod integration_test;
mod logger;
mod os_str_extension;
mod os_string_builder;
mod server;
mod shell_interface;
#[cfg(test)]
mod integration_test;
use crate::action::{Action, FileAction, ServerActions};
use crate::environment::{Environment, Prod};
@ -16,7 +16,7 @@ use crate::logger::{LogLevel, Logger};
use crate::os_str_extension::OsStrExtension;
use crate::os_string_builder::ReplaceWithOsStr;
use crate::server::{RelativeLocalPathAnker, ServerAddress};
use crate::shell_interface::{ScpParam, ServerCommand, ShellCommand, ShellInterface};
use crate::shell_interface::{ScpParam, ServerCommand, ShellCommand};
use clap::{Parser, Subcommand, ValueEnum};
use lazy_regex::{lazy_regex, Lazy, Regex};
use server::{Server, ServerReference};
@ -145,7 +145,7 @@ pub struct Application<E> {
impl<E> Application<E>
where
E: Environment + ShellInterface,
E: Environment,
{
pub fn run(&mut self) -> Result<(), String> {
let args = Args::try_parse_from(self.environment.args_os()).map_err(|e| e.to_string())?;