changed package name from 'fern' to 'shed'
This commit is contained in:
@@ -2002,7 +2002,7 @@ pub fn expand_prompt(raw: &str) -> ShResult<String> {
|
||||
result.push_str(&hostname);
|
||||
}
|
||||
PromptTk::HostnameShort => todo!(),
|
||||
PromptTk::ShellName => result.push_str("fern"),
|
||||
PromptTk::ShellName => result.push_str("shed"),
|
||||
PromptTk::Username => {
|
||||
let username = std::env::var("USER").unwrap();
|
||||
result.push_str(&username);
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::term::{Style, Styled};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum FernLogLevel {
|
||||
pub enum ShedLogLevel {
|
||||
NONE = 0,
|
||||
ERROR = 1,
|
||||
WARN = 2,
|
||||
@@ -13,9 +13,9 @@ pub enum FernLogLevel {
|
||||
TRACE = 5,
|
||||
}
|
||||
|
||||
impl Display for FernLogLevel {
|
||||
impl Display for ShedLogLevel {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
use FernLogLevel::*;
|
||||
use ShedLogLevel::*;
|
||||
match self {
|
||||
ERROR => write!(f, "{}", "ERROR".styled(Style::Red | Style::Bold)),
|
||||
WARN => write!(f, "{}", "WARN".styled(Style::Yellow | Style::Bold)),
|
||||
@@ -27,8 +27,8 @@ impl Display for FernLogLevel {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn log_level() -> FernLogLevel {
|
||||
use FernLogLevel::*;
|
||||
pub fn log_level() -> ShedLogLevel {
|
||||
use ShedLogLevel::*;
|
||||
let level = std::env::var("FERN_LOG_LEVEL").unwrap_or_default();
|
||||
match level.to_lowercase().as_str() {
|
||||
"error" => ERROR,
|
||||
@@ -40,7 +40,7 @@ pub fn log_level() -> FernLogLevel {
|
||||
}
|
||||
}
|
||||
|
||||
/// A structured logging macro designed for `fern`.
|
||||
/// A structured logging macro designed for `shed`.
|
||||
///
|
||||
/// `flog!` was implemented because `rustyline` uses `env_logger`, which
|
||||
/// clutters the debug output. This macro prints log messages in a structured
|
||||
|
||||
28
src/main.rs
28
src/main.rs
@@ -33,14 +33,14 @@ use crate::parse::execute::exec_input;
|
||||
use crate::prelude::*;
|
||||
use crate::prompt::get_prompt;
|
||||
use crate::prompt::readline::term::{RawModeGuard, raw_mode};
|
||||
use crate::prompt::readline::{FernVi, ReadlineEvent};
|
||||
use crate::prompt::readline::{ShedVi, ReadlineEvent};
|
||||
use crate::signal::{QUIT_CODE, check_signals, sig_setup, signals_pending};
|
||||
use crate::state::{read_logic, source_rc, write_jobs, write_meta};
|
||||
use clap::Parser;
|
||||
use state::{read_vars, write_vars};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
struct FernArgs {
|
||||
struct ShedArgs {
|
||||
script: Option<String>,
|
||||
|
||||
#[arg(short)]
|
||||
@@ -77,8 +77,8 @@ fn kickstart_lazy_evals() {
|
||||
fn setup_panic_handler() {
|
||||
let default_panic_hook = std::panic::take_hook();
|
||||
std::panic::set_hook(Box::new(move |info| {
|
||||
let _ = state::FERN.try_with(|fern| {
|
||||
if let Ok(mut jobs) = fern.jobs.try_borrow_mut() {
|
||||
let _ = state::FERN.try_with(|shed| {
|
||||
if let Ok(mut jobs) = shed.jobs.try_borrow_mut() {
|
||||
jobs.hang_up();
|
||||
}
|
||||
});
|
||||
@@ -92,14 +92,14 @@ fn main() -> ExitCode {
|
||||
kickstart_lazy_evals();
|
||||
setup_panic_handler();
|
||||
|
||||
let mut args = FernArgs::parse();
|
||||
let mut args = ShedArgs::parse();
|
||||
if env::args().next().is_some_and(|a| a.starts_with('-')) {
|
||||
// first arg is '-fern'
|
||||
// first arg is '-shed'
|
||||
// meaning we are in a login shell
|
||||
args.login_shell = true;
|
||||
}
|
||||
if args.version {
|
||||
println!("fern {} ({} {})", env!("CARGO_PKG_VERSION"), std::env::consts::ARCH, std::env::consts::OS);
|
||||
println!("shed {} ({} {})", env!("CARGO_PKG_VERSION"), std::env::consts::ARCH, std::env::consts::OS);
|
||||
return ExitCode::SUCCESS;
|
||||
}
|
||||
|
||||
@@ -108,14 +108,14 @@ fn main() -> ExitCode {
|
||||
} else if let Some(cmd) = args.command {
|
||||
exec_input(cmd, None, false)
|
||||
} else {
|
||||
fern_interactive()
|
||||
shed_interactive()
|
||||
} {
|
||||
eprintln!("fern: {e}");
|
||||
eprintln!("shed: {e}");
|
||||
};
|
||||
|
||||
if let Some(trap) = read_logic(|l| l.get_trap(TrapTarget::Exit))
|
||||
&& let Err(e) = exec_input(trap, None, false) {
|
||||
eprintln!("fern: error running EXIT trap: {e}");
|
||||
eprintln!("shed: error running EXIT trap: {e}");
|
||||
}
|
||||
|
||||
write_jobs(|j| j.hang_up());
|
||||
@@ -125,7 +125,7 @@ fn main() -> ExitCode {
|
||||
fn run_script<P: AsRef<Path>>(path: P, args: Vec<String>) -> ShResult<()> {
|
||||
let path = path.as_ref();
|
||||
if !path.is_file() {
|
||||
eprintln!("fern: Failed to open input file: {}", path.display());
|
||||
eprintln!("shed: Failed to open input file: {}", path.display());
|
||||
QUIT_CODE.store(1, Ordering::SeqCst);
|
||||
return Err(ShErr::simple(
|
||||
ShErrKind::CleanExit(1),
|
||||
@@ -133,7 +133,7 @@ fn run_script<P: AsRef<Path>>(path: P, args: Vec<String>) -> ShResult<()> {
|
||||
));
|
||||
}
|
||||
let Ok(input) = fs::read_to_string(path) else {
|
||||
eprintln!("fern: Failed to read input file: {}", path.display());
|
||||
eprintln!("shed: Failed to read input file: {}", path.display());
|
||||
QUIT_CODE.store(1, Ordering::SeqCst);
|
||||
return Err(ShErr::simple(
|
||||
ShErrKind::CleanExit(1),
|
||||
@@ -152,7 +152,7 @@ fn run_script<P: AsRef<Path>>(path: P, args: Vec<String>) -> ShResult<()> {
|
||||
exec_input(input, None, false)
|
||||
}
|
||||
|
||||
fn fern_interactive() -> ShResult<()> {
|
||||
fn shed_interactive() -> ShResult<()> {
|
||||
let _raw_mode = raw_mode(); // sets raw mode, restores termios on drop
|
||||
sig_setup();
|
||||
|
||||
@@ -161,7 +161,7 @@ fn fern_interactive() -> ShResult<()> {
|
||||
}
|
||||
|
||||
// Create readline instance with initial prompt
|
||||
let mut readline = match FernVi::new(get_prompt().ok(), *TTY_FILENO) {
|
||||
let mut readline = match ShedVi::new(get_prompt().ok(), *TTY_FILENO) {
|
||||
Ok(rl) => rl,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to initialize readline: {e}");
|
||||
|
||||
@@ -34,6 +34,6 @@ pub use nix::{
|
||||
};
|
||||
|
||||
pub use crate::flog;
|
||||
pub use crate::libsh::flog::FernLogLevel::*;
|
||||
pub use crate::libsh::flog::ShedLogLevel::*;
|
||||
|
||||
// Additional utilities, if needed, can be added here
|
||||
|
||||
@@ -226,7 +226,7 @@ impl History {
|
||||
let max_hist = crate::state::read_shopts(|s| s.core.max_hist);
|
||||
let path = PathBuf::from(env::var("FERNHIST").unwrap_or({
|
||||
let home = env::var("HOME").unwrap();
|
||||
format!("{home}/.fern_history")
|
||||
format!("{home}/.shed_history")
|
||||
}));
|
||||
let mut entries = read_hist_file(&path)?;
|
||||
// Enforce max_hist limit on loaded entries
|
||||
|
||||
@@ -101,7 +101,7 @@ pub enum ReadlineEvent {
|
||||
Pending,
|
||||
}
|
||||
|
||||
pub struct FernVi {
|
||||
pub struct ShedVi {
|
||||
pub reader: PollReader,
|
||||
pub writer: Box<dyn LineWriter>,
|
||||
|
||||
@@ -120,7 +120,7 @@ pub struct FernVi {
|
||||
pub needs_redraw: bool,
|
||||
}
|
||||
|
||||
impl FernVi {
|
||||
impl ShedVi {
|
||||
pub fn new(prompt: Option<String>, tty: RawFd) -> ShResult<Self> {
|
||||
let mut new = Self {
|
||||
reader: PollReader::new(),
|
||||
|
||||
@@ -23,7 +23,7 @@ use crate::{
|
||||
sys::TTY_FILENO,
|
||||
},
|
||||
prompt::readline::keys::{KeyCode, ModKeys},
|
||||
shopt::FernBellStyle,
|
||||
shopt::ShedBellStyle,
|
||||
state::read_shopts,
|
||||
};
|
||||
use crate::{
|
||||
|
||||
24
src/shopt.rs
24
src/shopt.rs
@@ -6,13 +6,13 @@ use crate::{
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum FernBellStyle {
|
||||
pub enum ShedBellStyle {
|
||||
Audible,
|
||||
Visible,
|
||||
Disable,
|
||||
}
|
||||
|
||||
impl FromStr for FernBellStyle {
|
||||
impl FromStr for ShedBellStyle {
|
||||
type Err = ShErr;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
@@ -28,13 +28,13 @@ impl FromStr for FernBellStyle {
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Copy, Debug)]
|
||||
pub enum FernEditMode {
|
||||
pub enum ShedEditMode {
|
||||
#[default]
|
||||
Vi,
|
||||
Emacs,
|
||||
}
|
||||
|
||||
impl FromStr for FernEditMode {
|
||||
impl FromStr for ShedEditMode {
|
||||
type Err = ShErr;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
match s.to_ascii_lowercase().as_str() {
|
||||
@@ -48,11 +48,11 @@ impl FromStr for FernEditMode {
|
||||
}
|
||||
}
|
||||
|
||||
impl Display for FernEditMode {
|
||||
impl Display for ShedEditMode {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
FernEditMode::Vi => write!(f, "vi"),
|
||||
FernEditMode::Emacs => write!(f, "emacs"),
|
||||
ShedEditMode::Vi => write!(f, "vi"),
|
||||
ShedEditMode::Emacs => write!(f, "emacs"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ impl ShOptCore {
|
||||
}
|
||||
"max_hist" => {
|
||||
let mut output = String::from(
|
||||
"Maximum number of entries in the command history file (default '.fernhist')\n",
|
||||
"Maximum number of entries in the command history file (default '.shedhist')\n",
|
||||
);
|
||||
output.push_str(&format!("{}", self.max_hist));
|
||||
Ok(Some(output))
|
||||
@@ -295,7 +295,7 @@ impl ShOptCore {
|
||||
Ok(Some(output))
|
||||
}
|
||||
"bell_enabled" => {
|
||||
let mut output = String::from("Whether or not to allow fern to trigger the terminal bell");
|
||||
let mut output = String::from("Whether or not to allow shed to trigger the terminal bell");
|
||||
output.push_str(&format!("{}", self.bell_enabled));
|
||||
Ok(Some(output))
|
||||
}
|
||||
@@ -366,7 +366,7 @@ impl Default for ShOptCore {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ShOptPrompt {
|
||||
pub trunc_prompt_path: usize,
|
||||
pub edit_mode: FernEditMode,
|
||||
pub edit_mode: ShedEditMode,
|
||||
pub comp_limit: usize,
|
||||
pub highlight: bool,
|
||||
pub auto_indent: bool,
|
||||
@@ -386,7 +386,7 @@ impl ShOptPrompt {
|
||||
self.trunc_prompt_path = val;
|
||||
}
|
||||
"edit_mode" => {
|
||||
let Ok(val) = val.parse::<FernEditMode>() else {
|
||||
let Ok(val) = val.parse::<ShedEditMode>() else {
|
||||
return Err(ShErr::simple(
|
||||
ShErrKind::SyntaxErr,
|
||||
"shopt: expected 'vi' or 'emacs' for edit_mode value",
|
||||
@@ -545,7 +545,7 @@ impl Default for ShOptPrompt {
|
||||
fn default() -> Self {
|
||||
ShOptPrompt {
|
||||
trunc_prompt_path: 4,
|
||||
edit_mode: FernEditMode::Vi,
|
||||
edit_mode: ShedEditMode::Vi,
|
||||
comp_limit: 100,
|
||||
highlight: true,
|
||||
auto_indent: true,
|
||||
|
||||
38
src/state.rs
38
src/state.rs
@@ -16,7 +16,7 @@ use crate::{
|
||||
}, parse::{ConjunctNode, NdRule, Node, ParsedSrc}, prelude::*, shopt::ShOpts
|
||||
};
|
||||
|
||||
pub struct Fern {
|
||||
pub struct Shed {
|
||||
pub jobs: RefCell<JobTab>,
|
||||
pub var_scopes: RefCell<ScopeStack>,
|
||||
pub meta: RefCell<MetaTab>,
|
||||
@@ -24,7 +24,7 @@ pub struct Fern {
|
||||
pub shopts: RefCell<ShOpts>,
|
||||
}
|
||||
|
||||
impl Fern {
|
||||
impl Shed {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
jobs: RefCell::new(JobTab::new()),
|
||||
@@ -36,7 +36,7 @@ impl Fern {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Fern {
|
||||
impl Default for Shed {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
@@ -123,7 +123,7 @@ impl ScopeStack {
|
||||
new.scopes.push(VarTab::new());
|
||||
let shell_name = std::env::args()
|
||||
.next()
|
||||
.unwrap_or_else(|| "fern".to_string());
|
||||
.unwrap_or_else(|| "shed".to_string());
|
||||
new
|
||||
.global_params
|
||||
.insert(ShellParam::ShellName.to_string(), shell_name);
|
||||
@@ -273,7 +273,7 @@ impl ScopeStack {
|
||||
}
|
||||
|
||||
thread_local! {
|
||||
pub static FERN: Fern = Fern::new();
|
||||
pub static FERN: Shed = Shed::new();
|
||||
}
|
||||
|
||||
/// A shell function
|
||||
@@ -569,8 +569,8 @@ impl VarTab {
|
||||
env::set_var("OLDPWD", pathbuf_to_string(std::env::current_dir()));
|
||||
env::set_var("HOME", home.clone());
|
||||
env::set_var("SHELL", pathbuf_to_string(std::env::current_exe()));
|
||||
env::set_var("FERN_HIST", format!("{}/.fernhist", home));
|
||||
env::set_var("FERN_RC", format!("{}/.fernrc", home));
|
||||
env::set_var("FERN_HIST", format!("{}/.shedhist", home));
|
||||
env::set_var("FERN_RC", format!("{}/.shedrc", home));
|
||||
}
|
||||
}
|
||||
pub fn init_sh_argv(&mut self) {
|
||||
@@ -803,49 +803,49 @@ impl MetaTab {
|
||||
|
||||
/// Read from the job table
|
||||
pub fn read_jobs<T, F: FnOnce(&JobTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&fern.jobs.borrow()))
|
||||
FERN.with(|shed| f(&shed.jobs.borrow()))
|
||||
}
|
||||
|
||||
/// Write to the job table
|
||||
pub fn write_jobs<T, F: FnOnce(&mut JobTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&mut fern.jobs.borrow_mut()))
|
||||
FERN.with(|shed| f(&mut shed.jobs.borrow_mut()))
|
||||
}
|
||||
|
||||
/// Read from the var scope stack
|
||||
pub fn read_vars<T, F: FnOnce(&ScopeStack) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&fern.var_scopes.borrow()))
|
||||
FERN.with(|shed| f(&shed.var_scopes.borrow()))
|
||||
}
|
||||
|
||||
/// Write to the variable table
|
||||
pub fn write_vars<T, F: FnOnce(&mut ScopeStack) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&mut fern.var_scopes.borrow_mut()))
|
||||
FERN.with(|shed| f(&mut shed.var_scopes.borrow_mut()))
|
||||
}
|
||||
|
||||
pub fn read_meta<T, F: FnOnce(&MetaTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&fern.meta.borrow()))
|
||||
FERN.with(|shed| f(&shed.meta.borrow()))
|
||||
}
|
||||
|
||||
/// Write to the meta table
|
||||
pub fn write_meta<T, F: FnOnce(&mut MetaTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&mut fern.meta.borrow_mut()))
|
||||
FERN.with(|shed| f(&mut shed.meta.borrow_mut()))
|
||||
}
|
||||
|
||||
/// Read from the logic table
|
||||
pub fn read_logic<T, F: FnOnce(&LogTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&fern.logic.borrow()))
|
||||
FERN.with(|shed| f(&shed.logic.borrow()))
|
||||
}
|
||||
|
||||
/// Write to the logic table
|
||||
pub fn write_logic<T, F: FnOnce(&mut LogTab) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&mut fern.logic.borrow_mut()))
|
||||
FERN.with(|shed| f(&mut shed.logic.borrow_mut()))
|
||||
}
|
||||
|
||||
pub fn read_shopts<T, F: FnOnce(&ShOpts) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&fern.shopts.borrow()))
|
||||
FERN.with(|shed| f(&shed.shopts.borrow()))
|
||||
}
|
||||
|
||||
pub fn write_shopts<T, F: FnOnce(&mut ShOpts) -> T>(f: F) -> T {
|
||||
FERN.with(|fern| f(&mut fern.shopts.borrow_mut()))
|
||||
FERN.with(|shed| f(&mut shed.shopts.borrow_mut()))
|
||||
}
|
||||
|
||||
pub fn descend_scope(argv: Option<Vec<String>>) {
|
||||
@@ -877,10 +877,10 @@ pub fn source_rc() -> ShResult<()> {
|
||||
PathBuf::from(&path)
|
||||
} else {
|
||||
let home = env::var("HOME").unwrap();
|
||||
PathBuf::from(format!("{home}/.fernrc"))
|
||||
PathBuf::from(format!("{home}/.shedrc"))
|
||||
};
|
||||
if !path.exists() {
|
||||
return Err(ShErr::simple(ShErrKind::InternalErr, ".fernrc not found"));
|
||||
return Err(ShErr::simple(ShErrKind::InternalErr, ".shedrc not found"));
|
||||
}
|
||||
source_file(path)
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
linebuf::LineBuf,
|
||||
term::{raw_mode, KeyReader, LineWriter},
|
||||
vimode::{ViInsert, ViMode, ViNormal},
|
||||
FernVi,
|
||||
ShedVi,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -180,11 +180,11 @@ impl LineWriter for TestWriter {
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: FernVi structure has changed significantly and readline() method no
|
||||
// NOTE: ShedVi structure has changed significantly and readline() method no
|
||||
// longer exists These test helpers are disabled until they can be properly
|
||||
// updated
|
||||
/*
|
||||
impl FernVi {
|
||||
impl ShedVi {
|
||||
pub fn new_test(prompt: Option<String>, input: &str, initial: &str) -> Self {
|
||||
Self {
|
||||
reader: Box::new(TestReader::new().with_initial(input.as_bytes())),
|
||||
@@ -200,10 +200,10 @@ impl FernVi {
|
||||
}
|
||||
}
|
||||
|
||||
fn fernvi_test(input: &str, initial: &str) -> String {
|
||||
let mut fernvi = FernVi::new_test(None, input, initial);
|
||||
fn shedvi_test(input: &str, initial: &str) -> String {
|
||||
let mut shedvi = ShedVi::new_test(None, input, initial);
|
||||
let raw_mode = raw_mode();
|
||||
let line = fernvi.readline().unwrap();
|
||||
let line = shedvi.readline().unwrap();
|
||||
std::mem::drop(raw_mode);
|
||||
line
|
||||
}
|
||||
@@ -642,24 +642,24 @@ fn editor_f_char_from_position_zero() {
|
||||
);
|
||||
}
|
||||
|
||||
// NOTE: These tests disabled because fernvi_test() helper is commented out
|
||||
// NOTE: These tests disabled because shedvi_test() helper is commented out
|
||||
/*
|
||||
#[test]
|
||||
fn fernvi_test_simple() {
|
||||
assert_eq!(fernvi_test("foo bar\x1bbdw\r", ""), "foo ")
|
||||
fn shedvi_test_simple() {
|
||||
assert_eq!(shedvi_test("foo bar\x1bbdw\r", ""), "foo ")
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fernvi_test_mode_change() {
|
||||
fn shedvi_test_mode_change() {
|
||||
assert_eq!(
|
||||
fernvi_test("foo bar biz buzz\x1bbbb2cwbiz buzz bar\r", ""),
|
||||
shedvi_test("foo bar biz buzz\x1bbbb2cwbiz buzz bar\r", ""),
|
||||
"foo biz buzz bar buzz"
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fernvi_test_lorem_ipsum_1() {
|
||||
assert_eq!(fernvi_test(
|
||||
fn shedvi_test_lorem_ipsum_1() {
|
||||
assert_eq!(shedvi_test(
|
||||
"\x1bwwwwwwww5dWdBdBjjdwjdwbbbcwasdasdasdasd\x1b\r",
|
||||
LOREM_IPSUM),
|
||||
"Lorem ipsum dolor sit amet, incididunt ut labore et dolore magna aliqua.\nUt enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in repin voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur asdasdasdasd occaecat cupinon proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\nCurabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra."
|
||||
@@ -667,9 +667,9 @@ fn fernvi_test_lorem_ipsum_1() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fernvi_test_lorem_ipsum_undo() {
|
||||
fn shedvi_test_lorem_ipsum_undo() {
|
||||
assert_eq!(
|
||||
fernvi_test(
|
||||
shedvi_test(
|
||||
"\x1bwwwwwwwwainserting some characters now...\x1bu\r",
|
||||
LOREM_IPSUM
|
||||
),
|
||||
@@ -678,8 +678,8 @@ fn fernvi_test_lorem_ipsum_undo() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fernvi_test_lorem_ipsum_ctrl_w() {
|
||||
assert_eq!(fernvi_test(
|
||||
fn shedvi_test_lorem_ipsum_ctrl_w() {
|
||||
assert_eq!(shedvi_test(
|
||||
"\x1bj5wiasdasdkjhaksjdhkajshd\x17wordswordswords\x17somemorewords\x17\x1b[D\x1b[D\x17\x1b\r",
|
||||
LOREM_IPSUM),
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\nUt enim ad minim am, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\nExcepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\nCurabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius, turpis et commodo pharetra."
|
||||
|
||||
@@ -4,25 +4,25 @@ use pretty_assertions::assert_eq;
|
||||
|
||||
use super::super::*;
|
||||
fn get_script_output(name: &str, args: &[&str]) -> Output {
|
||||
// Resolve the path to the fern binary.
|
||||
// Resolve the path to the shed binary.
|
||||
// Do not question me.
|
||||
let mut fern_path = env::current_exe().expect("Failed to get test executable"); // The path to the test executable
|
||||
fern_path.pop(); // Hocus pocus
|
||||
fern_path.pop();
|
||||
fern_path.push("fern"); // Abra Kadabra
|
||||
let mut shed_path = env::current_exe().expect("Failed to get test executable"); // The path to the test executable
|
||||
shed_path.pop(); // Hocus pocus
|
||||
shed_path.pop();
|
||||
shed_path.push("shed"); // Abra Kadabra
|
||||
|
||||
if !fern_path.is_file() {
|
||||
fern_path.pop();
|
||||
fern_path.pop();
|
||||
fern_path.push("release");
|
||||
fern_path.push("fern");
|
||||
if !shed_path.is_file() {
|
||||
shed_path.pop();
|
||||
shed_path.pop();
|
||||
shed_path.push("release");
|
||||
shed_path.push("shed");
|
||||
}
|
||||
|
||||
if !fern_path.is_file() {
|
||||
if !shed_path.is_file() {
|
||||
panic!("where the hell is the binary")
|
||||
}
|
||||
|
||||
process::Command::new(fern_path) // Alakazam
|
||||
process::Command::new(shed_path) // Alakazam
|
||||
.arg(name)
|
||||
.args(args)
|
||||
.output()
|
||||
|
||||
Reference in New Issue
Block a user