Listen to git commits for a specific repo and run a shell command

cargo fmt

vielle.dev 5ddf431e 145bae1c

verified
Changed files
+22 -6
src
+22 -6
src/main.rs
··· 40 // 0 args (std env args includes this script) 41 1 => {} 42 2 => { 43 - shell = Some(std::env::args().last().expect("Invalid state: 2 `Some` std::env::args() but found no Some values")) 44 } 45 3 => { 46 // load args and consume first ··· 63 repo_name = Some(val) 64 }; 65 } 66 - shell = Some(args.next().expect("Invalid state: 3 `Some` std::env::args() but only found 2")); 67 } 68 - 4 => { 69 // load args and consume first 70 let mut args = std::env::args(); 71 args.next(); 72 73 - handle = Some(args.next().expect("Invalid state: 4 `Some` std::env::args() but only found 1")); 74 - repo_name = Some(args.next().expect("Invalid state: 4 `Some` std::env::args() but only found 2")); 75 - shell = Some(args.next().expect("Invalid state: 4 `Some` std::env::args() but only found 3")); 76 } 77 _ => { 78 // err
··· 40 // 0 args (std env args includes this script) 41 1 => {} 42 2 => { 43 + shell = Some( 44 + std::env::args() 45 + .last() 46 + .expect("Invalid state: 2 `Some` std::env::args() but found no Some values"), 47 + ) 48 } 49 3 => { 50 // load args and consume first ··· 67 repo_name = Some(val) 68 }; 69 } 70 + shell = Some( 71 + args.next() 72 + .expect("Invalid state: 3 `Some` std::env::args() but only found 2"), 73 + ); 74 } 75 + 4 => { 76 // load args and consume first 77 let mut args = std::env::args(); 78 args.next(); 79 80 + handle = Some( 81 + args.next() 82 + .expect("Invalid state: 4 `Some` std::env::args() but only found 1"), 83 + ); 84 + repo_name = Some( 85 + args.next() 86 + .expect("Invalid state: 4 `Some` std::env::args() but only found 2"), 87 + ); 88 + shell = Some( 89 + args.next() 90 + .expect("Invalid state: 4 `Some` std::env::args() but only found 3"), 91 + ); 92 } 93 _ => { 94 // err