File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,12 +43,10 @@ jobs:
4343 {
4444 echo "## ripdiff $GITHUB_REF_NAME"
4545 echo
46- echo "Published to crates.io from tag \\`$GITHUB_REF_NAME\\`."
47- echo
4846 echo "Install with:"
49- echo "\\`\\`\\ `bash"
47+ echo "`` `bash"
5048 echo "cargo install ripdiff"
51- echo "\\`\\`\\ `"
49+ echo "`` `"
5250 } > release-notes.md
5351
5452 - name : Create GitHub release
Original file line number Diff line number Diff line change 5252Or point it at a specific repo:
5353
5454```
55- ripdiff --path /some/repo
55+ ripdiff /some/repo
5656```
5757
5858## Key Bindings
@@ -92,33 +92,3 @@ ripdiff --path /some/repo
9292| ` ] ` / ` [ ` | Jump to next / previous hunk |
9393| ` Space e ` | Hide / show file list sidebar |
9494| ` Enter ` | Toggle diff visibility for selected file |
95-
96- ## Quick Test
97-
98- ```
99- cd $(mktemp -d)
100- git init && git commit --allow-empty -m "init"
101- echo "hello" > test.txt
102- git add test.txt
103- ripdiff
104- ```
105-
106- Edit a file in another terminal — the diff auto-updates within ~ 1 second.
107-
108- ## Layout
109-
110- ```
111- ripdiff [repo: myproject] main 3 files changed mode: inline panel: files
112- M src/main.rs +5-2 │ src/main.rs
113- A src/lib.rs +3 │
114- M README.md +1-1 │ fn main() {
115- ? new_file.rs +12 │ - println!("old");
116- │ + println!("new");
117- │ }
118- ```
119-
120- - 25% left: file list with status indicators (M/A/D/R/?) and stage markers (` ● ` staged, ` ○ ` unstaged, ` ◐ ` mixed)
121- - 75% right: diff output with scrollbar
122- - ` h ` opens a help popup with keybinding and symbol descriptions
123- - Minimal borders — just a vertical divider between panels
124- - Auto-refreshes on ` .git/index ` changes and every 500ms
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Set FontSize 20
77Set Padding 24
88Set TypingSpeed 0 ms
99
10- Type "rd --path ~/Development/strava"
10+ Type "rd ~/Development/strava"
1111Enter
1212Sleep 2 s
1313
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ use tokio::sync::watch;
2323#[ command( name = "ripdiff" , about = "Terminal UI for navigating git diffs" ) ]
2424struct Args {
2525 /// Path to the git repository (defaults to current directory)
26- #[ arg( short , long ) ]
26+ #[ arg( value_name = "PATH" ) ]
2727 path : Option < PathBuf > ,
2828}
2929
@@ -87,3 +87,31 @@ async fn main() -> Result<()> {
8787 }
8888 }
8989}
90+
91+ #[ cfg( test) ]
92+ mod tests {
93+ use super :: Args ;
94+ use clap:: Parser ;
95+ use std:: path:: PathBuf ;
96+
97+ #[ test]
98+ fn parses_positional_path_argument ( ) {
99+ let args = Args :: parse_from ( [ "ripdiff" , "/tmp/repo" ] ) ;
100+
101+ assert_eq ! ( args. path, Some ( PathBuf :: from( "/tmp/repo" ) ) ) ;
102+ }
103+
104+ #[ test]
105+ fn defaults_path_when_not_provided ( ) {
106+ let args = Args :: parse_from ( [ "ripdiff" ] ) ;
107+
108+ assert_eq ! ( args. path, None ) ;
109+ }
110+
111+ #[ test]
112+ fn rejects_legacy_named_path_argument ( ) {
113+ let result = Args :: try_parse_from ( [ "ripdiff" , "--path" , "/tmp/repo" ] ) ;
114+
115+ assert ! ( result. is_err( ) ) ;
116+ }
117+ }
You can’t perform that action at this time.
0 commit comments