TUI #1
14
src/main.rs
14
src/main.rs
@ -49,12 +49,14 @@ struct Cli {
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let args = Cli::from_args();
|
||||
|
||||
// If the CLI was provided a directory to open use it.
|
||||
// Otherwise, attempt to find the home directory. If that fails use CWD.
|
||||
let root_path = args
|
||||
.path
|
||||
.or_else(dirs::home_dir)
|
||||
.unwrap_or_else(|| std::env::current_dir().expect("Failed to access filesystem."));
|
||||
let root_path = match args.path {
|
||||
// If the CLI was provided a directory convert it to absolute.
|
||||
Some(path) => std::path::absolute(path)?,
|
||||
// If no path was provided, use current directory.
|
||||
None => std::env::current_dir().unwrap_or_else(|_|
|
||||
// If we can't find the CWD attempt to open the home directory.
|
||||
dirs::home_dir().expect("Failed to access filesystem.")),
|
||||
};
|
||||
|
||||
// Open the TUI editor if requested, otherwise use the QML GUI by default.
|
||||
match args.tui {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user