git flow was a mistake #11
3 changed files with 38 additions and 11 deletions
|
@ -1,7 +1,8 @@
|
||||||
#+title: Roadmap
|
#+title: Roadmap
|
||||||
|
|
||||||
* 0.2.1
|
* 0.2.1
|
||||||
- [ ] jumps
|
- [X] jumps
|
||||||
|
- [-] repo and category selecting for subcommands
|
||||||
* 0.2.0 (maybe)
|
* 0.2.0 (maybe)
|
||||||
- [X] Links in categories?
|
- [X] Links in categories?
|
||||||
- [X] Fix category with no links
|
- [X] Fix category with no links
|
||||||
|
|
|
@ -84,7 +84,11 @@ pub enum Commands {
|
||||||
|
|
||||||
/// Do quick pull-commit-push with msg for commit
|
/// Do quick pull-commit-push with msg for commit
|
||||||
#[command(visible_alias = "q")]
|
#[command(visible_alias = "q")]
|
||||||
Quick { msg: Option<String> },
|
Quick {
|
||||||
|
repo: Option<String>,
|
||||||
|
name: Option<String>,
|
||||||
|
msg: Option<String>,
|
||||||
|
},
|
||||||
|
|
||||||
/// Do fast pull-commit-push with msg for commit, skipping repo on failure
|
/// Do fast pull-commit-push with msg for commit, skipping repo on failure
|
||||||
#[command(visible_alias = "f")]
|
#[command(visible_alias = "f")]
|
||||||
|
|
40
src/main.rs
40
src/main.rs
|
@ -74,15 +74,37 @@ fn main() {
|
||||||
Some(Commands::Link { msg: _ }) => {
|
Some(Commands::Link { msg: _ }) => {
|
||||||
config.link_all();
|
config.link_all();
|
||||||
}
|
}
|
||||||
Some(Commands::Quick { msg }) => {
|
// NOTE: This implements "sub-subcommand"-like matching on repository,
|
||||||
let s = Box::leak(
|
// name, and additional data for a subcommand
|
||||||
msg.as_mut()
|
// TODO: generalize for reuse by all commands that operate on repo->name->msg
|
||||||
.get_or_insert(&mut QUICK_COMMIT.to_string())
|
Some(Commands::Quick { repo, name, msg }) => match (&repo, &name, &msg) {
|
||||||
.clone()
|
(None, None, None) => {
|
||||||
.into_boxed_str(),
|
let s = Box::leak(
|
||||||
);
|
msg.as_mut()
|
||||||
config.quick(s);
|
.get_or_insert(&mut QUICK_COMMIT.to_string())
|
||||||
}
|
.clone()
|
||||||
|
.into_boxed_str(),
|
||||||
|
);
|
||||||
|
config.quick(s);
|
||||||
|
}
|
||||||
|
(repo, None, None) => {
|
||||||
|
println!("{}", repo.as_ref().unwrap());
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
(repo, name, None) => {
|
||||||
|
println!("{} {}", repo.as_ref().unwrap(), name.as_ref().unwrap());
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
(repo, name, msg) => {
|
||||||
|
println!(
|
||||||
|
"{} {} {}",
|
||||||
|
repo.as_ref().unwrap(),
|
||||||
|
name.as_ref().unwrap(),
|
||||||
|
msg.as_ref().unwrap(),
|
||||||
|
);
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
|
},
|
||||||
Some(Commands::Fast { msg }) => {
|
Some(Commands::Fast { msg }) => {
|
||||||
let s = Box::leak(
|
let s = Box::leak(
|
||||||
msg.as_mut()
|
msg.as_mut()
|
||||||
|
|
Loading…
Reference in a new issue