Update formatter to not include newlines inbetween path results; update changelog

pull/131/head
Chip Senkbeil 2 years ago
parent 4230a2810c
commit 0dd1297131
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `SystemInfo` via ssh backend now reports os when windows detected
- `Capabilities` request/response for server and manager that report back the
capabilities (and descriptions) supported by the server or manager
- `Search` and `CancelSearch` request/response for server that performs a
search using `grep` crate against paths or file contents, returning results
back as a stream
- New `Searcher` available as part of distant client interface to support
performing a search and getting back results
- Updated `DistantChannelExt` to support creating a `Searcher` and canceling
an ongoing search query
- `distant client action search` now supported, waiting for results and
printing them out
### Changed
@ -37,9 +46,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- `shutdown-after` replaced with `shutdown` that supports three options:
1. `never` - server will never shutdown automatically
2. `after=N` - server will shutdown after N seconds
3. `lonely=N` - server will shutdown N seconds after no connections
1. `never` - server will never shutdown automatically
2. `after=N` - server will shutdown after N seconds
3. `lonely=N` - server will shutdown N seconds after no connections
## [0.17.6] - 2022-08-18
### Fixed

@ -306,12 +306,14 @@ fn format_shell(state: &mut FormatterState, data: DistantResponseData) -> Output
DistantResponseData::SearchDone { .. } => Output::None,
DistantResponseData::SearchResults { matches, .. } => {
let mut files: HashMap<_, Vec<String>> = HashMap::new();
let mut is_targeting_paths = false;
for m in matches {
match m {
SearchQueryMatch::Path(SearchQueryPathMatch { path, .. }) => {
// Create the entry with no lines called out
files.entry(path).or_default();
is_targeting_paths = true;
}
SearchQueryMatch::Contents(SearchQueryContentsMatch {
@ -337,8 +339,9 @@ fn format_shell(state: &mut FormatterState, data: DistantResponseData) -> Output
// If we are seening a new path, print it out
if state.last_searched_path.as_deref() != Some(path.as_path()) {
// If we have already seen some path before, we would have printed it, and
// we want to add a space between it and the current path
if state.last_searched_path.is_some() {
// we want to add a space between it and the current path, but only if we are
// printing out file content matches and not paths
if state.last_searched_path.is_some() && !is_targeting_paths {
writeln!(&mut output).unwrap();
}

Loading…
Cancel
Save