Improve error message when $AUTIN_SESSION is not set. (#654)
Closes #653
This commit is contained in:
parent
a5616aea8f
commit
b01d9f81b0
1 changed files with 4 additions and 2 deletions
|
@ -26,8 +26,10 @@ pub struct Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_context() -> Context {
|
pub fn current_context() -> Context {
|
||||||
let session =
|
let Ok(session) = env::var("ATUIN_SESSION") else {
|
||||||
env::var("ATUIN_SESSION").expect("failed to find ATUIN_SESSION - check your shell setup");
|
eprintln!("ERROR: Failed to find $ATUIN_SESSION in the environment. Check that you have correctly set up your shell.");
|
||||||
|
std::process::exit(1);
|
||||||
|
};
|
||||||
let hostname = format!("{}:{}", whoami::hostname(), whoami::username());
|
let hostname = format!("{}:{}", whoami::hostname(), whoami::username());
|
||||||
let cwd = match env::current_dir() {
|
let cwd = match env::current_dir() {
|
||||||
Ok(dir) => dir.display().to_string(),
|
Ok(dir) => dir.display().to_string(),
|
||||||
|
|
Loading…
Reference in a new issue