|
|
@ -11,7 +11,9 @@ pub struct CmdLineSettings {
|
|
|
|
pub neovim_bin: Option<String>,
|
|
|
|
pub neovim_bin: Option<String>,
|
|
|
|
pub files_to_open: Vec<String>,
|
|
|
|
pub files_to_open: Vec<String>,
|
|
|
|
|
|
|
|
|
|
|
|
pub nofork: bool,
|
|
|
|
pub no_fork: bool,
|
|
|
|
|
|
|
|
pub no_idle: bool,
|
|
|
|
|
|
|
|
pub srgb: bool,
|
|
|
|
pub geometry: Dimensions,
|
|
|
|
pub geometry: Dimensions,
|
|
|
|
pub wsl: bool,
|
|
|
|
pub wsl: bool,
|
|
|
|
pub remote_tcp: Option<String>,
|
|
|
|
pub remote_tcp: Option<String>,
|
|
|
@ -25,12 +27,15 @@ pub struct CmdLineSettings {
|
|
|
|
impl Default for CmdLineSettings {
|
|
|
|
impl Default for CmdLineSettings {
|
|
|
|
fn default() -> Self {
|
|
|
|
fn default() -> Self {
|
|
|
|
Self {
|
|
|
|
Self {
|
|
|
|
neovim_bin: None,
|
|
|
|
|
|
|
|
verbosity: 0,
|
|
|
|
verbosity: 0,
|
|
|
|
log_to_file: false,
|
|
|
|
log_to_file: false,
|
|
|
|
|
|
|
|
neovim_bin: None,
|
|
|
|
neovim_args: vec![],
|
|
|
|
neovim_args: vec![],
|
|
|
|
files_to_open: vec![],
|
|
|
|
files_to_open: vec![],
|
|
|
|
nofork: false,
|
|
|
|
|
|
|
|
|
|
|
|
no_fork: false,
|
|
|
|
|
|
|
|
no_idle: false,
|
|
|
|
|
|
|
|
srgb: true,
|
|
|
|
geometry: DEFAULT_WINDOW_GEOMETRY,
|
|
|
|
geometry: DEFAULT_WINDOW_GEOMETRY,
|
|
|
|
wsl: false,
|
|
|
|
wsl: false,
|
|
|
|
remote_tcp: None,
|
|
|
|
remote_tcp: None,
|
|
|
@ -64,6 +69,16 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
|
|
|
|
.long("nofork")
|
|
|
|
.long("nofork")
|
|
|
|
.help("Do not detach process from terminal"),
|
|
|
|
.help("Do not detach process from terminal"),
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
.arg(
|
|
|
|
|
|
|
|
Arg::with_name("noidle")
|
|
|
|
|
|
|
|
.long("noidle")
|
|
|
|
|
|
|
|
.help("Render every frame. Takes more power and cpu time but possibly fixes animation issues"),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.arg(
|
|
|
|
|
|
|
|
Arg::with_name("srgb")
|
|
|
|
|
|
|
|
.long("srgb")
|
|
|
|
|
|
|
|
.help("Use standard color space to initialize the window. Swapping this variable sometimes fixes issues on startup"),
|
|
|
|
|
|
|
|
)
|
|
|
|
.arg(
|
|
|
|
.arg(
|
|
|
|
Arg::with_name("maximized")
|
|
|
|
Arg::with_name("maximized")
|
|
|
|
.long("maximized")
|
|
|
|
.long("maximized")
|
|
|
@ -129,24 +144,27 @@ pub fn handle_command_line_arguments() -> Result<(), String> {
|
|
|
|
* NEOVIDE_MULTIGRID || --multigrid
|
|
|
|
* NEOVIDE_MULTIGRID || --multigrid
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
SETTINGS.set::<CmdLineSettings>(&CmdLineSettings {
|
|
|
|
SETTINGS.set::<CmdLineSettings>(&CmdLineSettings {
|
|
|
|
neovim_bin: std::env::var("NEOVIM_BIN").ok(),
|
|
|
|
verbosity: matches.occurrences_of("verbosity"),
|
|
|
|
|
|
|
|
log_to_file: matches.is_present("log_to_file"),
|
|
|
|
neovim_args: matches
|
|
|
|
neovim_args: matches
|
|
|
|
.values_of("neovim_args")
|
|
|
|
.values_of("neovim_args")
|
|
|
|
.map(|opt| opt.map(|v| v.to_owned()).collect())
|
|
|
|
.map(|opt| opt.map(|v| v.to_owned()).collect())
|
|
|
|
.unwrap_or_default(),
|
|
|
|
.unwrap_or_default(),
|
|
|
|
verbosity: matches.occurrences_of("verbosity"),
|
|
|
|
neovim_bin: std::env::var("NEOVIM_BIN").ok(),
|
|
|
|
log_to_file: matches.is_present("log_to_file"),
|
|
|
|
|
|
|
|
files_to_open: matches
|
|
|
|
files_to_open: matches
|
|
|
|
.values_of("files")
|
|
|
|
.values_of("files")
|
|
|
|
.map(|opt| opt.map(|v| v.to_owned()).collect())
|
|
|
|
.map(|opt| opt.map(|v| v.to_owned()).collect())
|
|
|
|
.unwrap_or_default(),
|
|
|
|
.unwrap_or_default(),
|
|
|
|
maximized: matches.is_present("maximized") || std::env::var("NEOVIDE_MAXIMIZED").is_ok(),
|
|
|
|
|
|
|
|
multi_grid: std::env::var("NEOVIDE_MULTIGRID").is_ok() || matches.is_present("multi_grid"),
|
|
|
|
no_fork: matches.is_present("nofork") || matches.is_present("verbosity"),
|
|
|
|
remote_tcp: matches.value_of("remote_tcp").map(|i| i.to_owned()),
|
|
|
|
no_idle: matches.is_present("noidle") || std::env::var("NEOVIDE_NOIDLE").is_ok(),
|
|
|
|
nofork: matches.is_present("nofork") || matches.is_present("verbosity"),
|
|
|
|
srgb: matches.is_present("srgb") || !std::env::var("NEOVIDE_NO_SRGB").is_ok(),
|
|
|
|
|
|
|
|
geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,
|
|
|
|
wsl: matches.is_present("wsl"),
|
|
|
|
wsl: matches.is_present("wsl"),
|
|
|
|
|
|
|
|
remote_tcp: matches.value_of("remote_tcp").map(|i| i.to_owned()),
|
|
|
|
|
|
|
|
multi_grid: std::env::var("NEOVIDE_MULTIGRID").is_ok() || matches.is_present("multi_grid"),
|
|
|
|
|
|
|
|
maximized: matches.is_present("maximized") || std::env::var("NEOVIDE_MAXIMIZED").is_ok(),
|
|
|
|
frameless: matches.is_present("frameless") || std::env::var("NEOVIDE_FRAMELESS").is_ok(),
|
|
|
|
frameless: matches.is_present("frameless") || std::env::var("NEOVIDE_FRAMELESS").is_ok(),
|
|
|
|
geometry: parse_window_geometry(matches.value_of("geometry").map(|i| i.to_owned()))?,
|
|
|
|
|
|
|
|
wayland_app_id: match std::env::var("NEOVIDE_APP_ID") {
|
|
|
|
wayland_app_id: match std::env::var("NEOVIDE_APP_ID") {
|
|
|
|
Ok(val) => val,
|
|
|
|
Ok(val) => val,
|
|
|
|
Err(_) => matches
|
|
|
|
Err(_) => matches
|
|
|
|