aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/tty/unix.rs
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2019-05-10 11:36:16 +0000
committerGitHub <noreply@github.com>2019-05-10 11:36:16 +0000
commit5d173f6df3b20308eb318cef4b58147b2197d5f9 (patch)
tree05638837bef25d65a818253814331a4f429f57ac /alacritty_terminal/src/tty/unix.rs
parent7738c52ed4eb177ead9f43d14207ecb129cfe617 (diff)
downloadalacritty-5d173f6df3b20308eb318cef4b58147b2197d5f9.tar.gz
alacritty-5d173f6df3b20308eb318cef4b58147b2197d5f9.zip
Refactor config parsing files
This is a large refactor of the config parsing structure, attempting to reduce the size of the file a bit by splitting it up into different modules with more specific purposes. This also fixes #2279.
Diffstat (limited to 'alacritty_terminal/src/tty/unix.rs')
-rw-r--r--alacritty_terminal/src/tty/unix.rs19
1 files changed, 6 insertions, 13 deletions
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index 668fe7bd..0cf1a821 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -15,7 +15,7 @@
//! tty related functionality
//!
-use crate::config::{Config, Options, Shell};
+use crate::config::{Config, Shell};
use crate::display::OnResize;
use crate::term::SizeInfo;
use crate::tty::{ChildEvent, EventedPty, EventedReadWrite};
@@ -154,12 +154,7 @@ impl Pty {
}
/// Create a new tty and return a handle to interact with it.
-pub fn new<T: ToWinsize>(
- config: &Config,
- options: &Options,
- size: &T,
- window_id: Option<usize>,
-) -> Pty {
+pub fn new<T: ToWinsize>(config: &Config, size: &T, window_id: Option<usize>) -> Pty {
let win_size = size.to_winsize();
let mut buf = [0; 1024];
let pw = get_pw_entry(&mut buf);
@@ -174,12 +169,10 @@ pub fn new<T: ToWinsize>(
} else {
Shell::new(pw.shell)
};
- let shell = config.shell().unwrap_or(&default_shell);
+ let shell = config.shell.as_ref().unwrap_or(&default_shell);
- let initial_command = options.command().unwrap_or(shell);
-
- let mut builder = Command::new(initial_command.program());
- for arg in initial_command.args() {
+ let mut builder = Command::new(&*shell.program);
+ for arg in &shell.args {
builder.arg(arg);
}
@@ -230,7 +223,7 @@ pub fn new<T: ToWinsize>(
});
// Handle set working directory option
- if let Some(ref dir) = options.working_dir {
+ if let Some(ref dir) = config.working_directory() {
builder.current_dir(dir.as_path());
}