Skip to content

Commit

Permalink
Rename to scooter
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasschafer committed Nov 13, 2024
1 parent 57f4281 commit db256d9
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 22 deletions.
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
[package]
name = "scout"
name = "scooter"
version = "0.1.0"
edition = "2021"
authors = ["[email protected]"]
license = "MIT"
description = "Interactive find and replace in the terminal"
readme = "README.md"
homepage = "https://github.com/thomasschafer/scooter"
repository = "https://github.com/thomasschafer/scooter"
keywords = ["cli", "find", "search", "replace"]
categories = ["command-line-utilities"]

[dependencies]
anyhow = "1.0.86"
Expand All @@ -24,5 +32,5 @@ tokio = { version = "1.40.0", features = ["full"] }
tempfile = "3.12.0"

[lib]
name = "scout"
name = "scooter"
path = "src/lib.rs"
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
# scout
# scooter

Scout is an interactive find-and-replace terminal UI app.
Scooter is an interactive find-and-replace terminal UI app.

Search with either a fixed string or a regular expression, enter a replacement, and interactively toggle which instances you want to replace. You can also specify a regex pattern for the file paths you want to search.

If the instance you're attempting to replace has changed since the search was performed, e.g. if you've switched branches and that line no longer exists, that particular replacement won't occur: you'll see all such cases at the end.

![Scout preview](media/preview.gif)
![Scooter preview](media/preview.gif)

## Installation

Install with
### Cargo

Ensure you have cargo installed (see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html)), and then run

```sh
cargo install scooter
```

### Building from source

Ensure you have cargo installed (see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html)), then pull down the repo and run

```sh
cargo install --path .
```

then run `scout` from the directory you want to search in.
## Usage

Run `scooter` in a terminal to launch Scooter. You can then enter some text to search with and text to replace matches with, toggle on or off fixed strings, and enter a regex pattern that filenames must match. A more extensive set of keymappings will be shown at the bottom of the window: these vary slightly depending on the screen you're on.
Binary file modified media/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};

use etcetera::base_strategy::{choose_base_strategy, BaseStrategy};

const APP_NAME: &str = "scout";
const APP_NAME: &str = "scooter";

pub fn cache_dir() -> PathBuf {
let strategy = choose_base_strategy().expect("Error when finding cache directory");
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn render(app: &App, frame: &mut Frame) {
.split(frame.size());

let title_block = Block::default().style(Style::default());
let title = Paragraph::new(Text::styled("Scout", Style::default()))
let title = Paragraph::new(Text::styled("Scooter", Style::default()))
.block(title_block)
.alignment(Alignment::Center);
frame.render_widget(title, chunks[0]);
Expand Down
10 changes: 5 additions & 5 deletions tests/app.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use scout::{
use scooter::{
App, CurrentScreen, EventHandler, ReplaceResult, ReplaceState, Results, SearchFields,
SearchResult, SearchState,
};
Expand Down Expand Up @@ -146,7 +146,7 @@ async fn test_update_search_results_fixed_string() {

app.update_search_results().unwrap();

if let scout::Results::SearchComplete(search_state) = &app.results {
if let scooter::Results::SearchComplete(search_state) = &app.results {
assert_eq!(search_state.results.len(), 1);

for (file_name, num_matches) in [("file1.txt", 0), ("file1.txt", 0), ("file3.txt", 1)] {
Expand Down Expand Up @@ -177,7 +177,7 @@ async fn test_update_search_results_regex() {

app.update_search_results().unwrap();

if let scout::Results::SearchComplete(search_state) = &app.results {
if let scooter::Results::SearchComplete(search_state) = &app.results {
assert_eq!(search_state.results.len(), 4,);

let mut file_match_counts = std::collections::HashMap::new();
Expand Down Expand Up @@ -220,7 +220,7 @@ async fn test_update_search_results_no_matches() {

app.update_search_results().unwrap();

if let scout::Results::SearchComplete(search_state) = &app.results {
if let scooter::Results::SearchComplete(search_state) = &app.results {
assert_eq!(search_state.results.len(), 0);
} else {
panic!("Expected SearchComplete results");
Expand Down Expand Up @@ -278,7 +278,7 @@ async fn test_update_search_results_filtered_dir() {
let result = app.update_search_results();
assert!(result.is_ok());

if let scout::Results::SearchComplete(search_state) = &app.results {
if let scooter::Results::SearchComplete(search_state) = &app.results {
assert_eq!(search_state.results.len(), 2);

for (file_name, num_matches) in [
Expand Down
2 changes: 1 addition & 1 deletion tests/fields.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ratatui::crossterm::event::{KeyCode, KeyModifiers};
use scout::{CheckboxField, Field, FieldName, SearchField, SearchFields, SearchType, TextField};
use scooter::{CheckboxField, Field, FieldName, SearchField, SearchFields, SearchType, TextField};
use std::cell::RefCell;
use std::rc::Rc;

Expand Down

0 comments on commit db256d9

Please sign in to comment.