-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,432 additions
and
868 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::{diagnostic::IntoDiagnostic, path::Path, Result}; | ||
use core::cell::RefCell; | ||
use once_cell::sync::Lazy; | ||
use std::sync::Arc; | ||
|
||
static GLOBAL_ARGS: Lazy<Arc<[String]>> = Lazy::new(|| std::env::args().collect()); | ||
static GLOBAL_DIR: Lazy<Result<Path>> = | ||
Lazy::new(|| std::env::current_dir().map(|v| v.into()).into_diagnostic()); | ||
|
||
thread_local! { | ||
static ARGS: RefCell<Arc<[String]>> = RefCell::new(GLOBAL_ARGS.clone()); | ||
static DIR: RefCell<Result<Path>> = RefCell::new(GLOBAL_DIR.clone()); | ||
} | ||
|
||
pub fn args() -> Arc<[String]> { | ||
ARGS.with(|current| current.borrow().clone()) | ||
} | ||
|
||
pub fn set_args(args: Arc<[String]>) { | ||
ARGS.with(|current| *current.borrow_mut() = args); | ||
} | ||
|
||
pub fn current_dir() -> Result<Path> { | ||
DIR.with(|current| current.borrow().clone()) | ||
} | ||
|
||
pub fn set_current_dir(dir: Path) { | ||
DIR.with(|current| *current.borrow_mut() = Ok(dir)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
version = "1" | ||
|
||
[source] | ||
pattern = "src/**/*.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.