-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When `--watch-restart` paths change, the ghci session is restarted (like when modules are removed or renamed). ghcid-ng also restarts on `.cabal` file and `.ghci` changes. When files with a `--watch-extension` change, the ghci session is reloaded.
- Loading branch information
Showing
14 changed files
with
411 additions
and
240 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//! Adapter for parsing [`NormalPath`]s with a [`clap::builder::Arg::value_parser`]. | ||
use clap::builder::PathBufValueParser; | ||
use clap::builder::TypedValueParser; | ||
use clap::builder::ValueParserFactory; | ||
|
||
use crate::normal_path::NormalPath; | ||
|
||
/// [`clap`] parser for [`NormalPath`] values. | ||
#[derive(Default, Clone)] | ||
pub struct NormalPathValueParser { | ||
inner: PathBufValueParser, | ||
} | ||
|
||
impl TypedValueParser for NormalPathValueParser { | ||
type Value = NormalPath; | ||
|
||
fn parse_ref( | ||
&self, | ||
cmd: &clap::Command, | ||
arg: Option<&clap::Arg>, | ||
value: &std::ffi::OsStr, | ||
) -> Result<Self::Value, clap::Error> { | ||
self.inner.parse_ref(cmd, arg, value).and_then(|path_buf| { | ||
NormalPath::from_cwd(path_buf).map_err(|err| { | ||
super::value_validation_error(arg, &value.to_string_lossy(), format!("{err:?}")) | ||
}) | ||
}) | ||
} | ||
} | ||
|
||
impl ValueParserFactory for NormalPath { | ||
type Parser = NormalPathValueParser; | ||
|
||
fn value_parser() -> Self::Parser { | ||
Self::Parser::default() | ||
} | ||
} |
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
Oops, something went wrong.