Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
d1b20ee5aa | |||
da00f41205 |
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.1.1] - 2025-08-04
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- if path is empty default to `.`
|
||||||
|
|
||||||
## [0.1.0] - 2025-08-03
|
## [0.1.0] - 2025-08-03
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -431,7 +431,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "noil"
|
name = "noil"
|
||||||
version = "0.0.5"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_term",
|
"ansi_term",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
|||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
[workspace.package]
|
[workspace.package]
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
noil = { path = "crates/noil" }
|
noil = { path = "crates/noil" }
|
||||||
|
@@ -62,9 +62,10 @@ impl EditCommand {
|
|||||||
.await
|
.await
|
||||||
.context("create temp file for noil")?;
|
.context("create temp file for noil")?;
|
||||||
|
|
||||||
let output = get_outputs(&self.get_path().await.context("get path")?, true)
|
let path = &self.get_path().await.context("get path")?;
|
||||||
|
let output = get_outputs(path, true)
|
||||||
.await
|
.await
|
||||||
.context("get output")?;
|
.context(format!("get output: {}", path.display()))?;
|
||||||
file.write_all(output.as_bytes())
|
file.write_all(output.as_bytes())
|
||||||
.await
|
.await
|
||||||
.context("write contents for edit")?;
|
.context("write contents for edit")?;
|
||||||
@@ -151,10 +152,16 @@ impl EditCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
return path
|
let parent_path = path
|
||||||
.parent()
|
.parent()
|
||||||
.map(|p| p.to_path_buf())
|
.map(|p| p.to_path_buf())
|
||||||
.ok_or(anyhow::anyhow!("parent doesn't exist for file"));
|
.ok_or(anyhow::anyhow!("parent doesn't exist for file"))?;
|
||||||
|
|
||||||
|
if parent_path.display().to_string() == "" {
|
||||||
|
return Ok(PathBuf::from("."));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ok(parent_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(path.clone())
|
Ok(path.clone())
|
||||||
|
Reference in New Issue
Block a user