Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ in tags
```

Example output:

```
Showing the last 10 of 12 tags (from 2025-07-31 to 2025-07-31). Use --all to see all.

Expand All @@ -115,6 +116,41 @@ To view all tags, use the `--all` flag.
in tags --all
```

## Branch Operations

The `in br` command provides Git branch management functionality.

### Finish Branch

Finish the current branch by merging it to the main branch and cleaning up:

```bash
in br finish
```

This command will:

- Check if the current branch is merged to the main branch
- Switch to the main branch
- Pull the latest changes
- Delete the feature branch
- Handle any uncommitted changes with stash if needed

Comment thread
coderabbitai[bot] marked this conversation as resolved.
### Open Remote Repository

Open the remote repository in your default browser:

```bash
in br open
```

This command will:

- Parse the `.git/config` file to find the remote origin URL
- Convert SSH/HTTPS Git URLs to web URLs
- For GitHub repositories, automatically navigate to the current branch
- Open the URL in your default browser

### License

MIT
27 changes: 23 additions & 4 deletions src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub enum InspectionCommand {
ShowWorkingDirectory(InspectForWorkingDirectory),
ListFileSize(InspectForFileSize),
DirMark(InspectForDirMark),
FinishBranch(InspectForFinishBranch),
Branch(InspectForBranch),
ShowTags(InspectForTags),
}

Expand Down Expand Up @@ -93,11 +93,30 @@ pub struct InspectForDirMark {
pub subcommand: DirMarkCommand,
}

// InspectForFinishBranch
/// command for branch operations
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "br")]
pub struct InspectForBranch {
#[argh(subcommand)]
pub subcommand: BranchCommand,
}

#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
pub enum BranchCommand {
Finish(InspectForBranchFinish),
Open(InspectForBranchOpen),
}

/// command for finishing a branch
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "finbr")]
pub struct InspectForFinishBranch {}
#[argh(subcommand, name = "finish")]
pub struct InspectForBranchFinish {}

/// command for opening remote repository
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "open")]
pub struct InspectForBranchOpen {}

#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
Expand Down
8 changes: 4 additions & 4 deletions src/dir_marks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl DirMarks {
.marks
.push(Bookmark::new(kwd.to_owned(), path.to_owned(), description.to_owned()));
}
println!("added `{}`\t{}\t{}", kwd, path, description)
println!("added `{kwd}`\t{path}\t{description}")
}

pub fn remove(&mut self, kwd: &str) {
Expand All @@ -91,7 +91,7 @@ impl DirMarks {
println!("removed `{}`\t{}\t{}", target.kwd, target.path, target.description);
self.marks.retain(|m| m.kwd != kwd);
} else {
println!("`{}` not found", kwd);
println!("`{kwd}` not found");
}
}

Expand All @@ -103,7 +103,7 @@ impl DirMarks {
pub fn jump(&mut self, kwd: &str) -> Result<(), String> {
// remove file in `JUMP_TARGET_DATA_PATH`` first
if std::path::Path::new(JUMP_TARGET_DATA_PATH).exists() {
std::fs::remove_file(JUMP_TARGET_DATA_PATH).map_err(|e| format!("failed to remove {}", e))?;
std::fs::remove_file(JUMP_TARGET_DATA_PATH).map_err(|e| format!("failed to remove {e}"))?;
}

// match by exact keyword
Expand Down Expand Up @@ -218,6 +218,6 @@ impl DirMarks {

/// print shell function for zsh
pub fn shell_fn() {
println!("{}", SHELL_FN_GG);
println!("{SHELL_FN_GG}");
}
}
Loading
Loading