chore: merge 0.0.6 #6

Merged
cafkafk merged 28 commits from dev into main 2023-07-02 10:35:50 +02:00
5 changed files with 46 additions and 33 deletions
Showing only changes of commit 25fe576052 - Show all commits

View file

@ -1,12 +1,14 @@
#+title: Roadmap #+title: Roadmap
* Roadmap * Roadmap [0%] [0/4]
- [ ] Custom operation sequences - [ ] Custom operation sequences
- [ ] Generic repositories - [ ] Generic repositories
- [ ] Version pinning - [ ] Version pinning
- [ ] libgit2 (maybe) - [ ] libgit2 (maybe)
* 0.1.0 * 0.1.0 [0%] [0/5]
- [-] No functionality regressions - [-] No functionality regressions
- [X] commit works in quick, fast
- [-] commit with edit works
- [ ] Repo Flags Finished - [ ] Repo Flags Finished
- [ ] Category Flags Finished - [ ] Category Flags Finished
- [ ] Optional Fields - [ ] Optional Fields

View file

@ -437,8 +437,6 @@ impl Config {
} }
/// Tries to pull, add all, commit with msg "quick commit", and push all /// Tries to pull, add all, commit with msg "quick commit", and push all
/// repositories, skips if fail. /// repositories, skips if fail.
///
/// FIXME currently msg isn't used
pub fn quick(&self, msg: &'static str) { pub fn quick(&self, msg: &'static str) {
debug!("exectuting quick"); debug!("exectuting quick");
let series: Vec<SeriesItem> = vec![ let series: Vec<SeriesItem> = vec![
@ -453,7 +451,7 @@ impl Config {
SeriesItem { SeriesItem {
operation: "commit", operation: "commit",
closure: Box::new(move |repo: &GitRepo| repo.commit_with_msg(msg)), closure: Box::new(move |repo: &GitRepo| repo.commit_with_msg(msg)),
}, // FIXME doesn't take msg },
SeriesItem { SeriesItem {
operation: "push", operation: "push",
closure: Box::new(move |repo: &GitRepo| repo.push()), closure: Box::new(move |repo: &GitRepo| repo.push()),
@ -463,9 +461,7 @@ impl Config {
} }
/// Tries to pull, add all, commit with msg "quick commit", and push all /// Tries to pull, add all, commit with msg "quick commit", and push all
/// repositories, skips if fail. /// repositories, skips if fail.
/// pub fn fast(&self, msg: &'static str) {
/// FIXME currently msg isn't used
pub fn fast(&self, msg: &str) {
debug!("exectuting fast"); debug!("exectuting fast");
let series: Vec<SeriesItem> = vec![ let series: Vec<SeriesItem> = vec![
SeriesItem { SeriesItem {
@ -479,7 +475,7 @@ impl Config {
SeriesItem { SeriesItem {
operation: "commit", operation: "commit",
closure: Box::new(move |repo: &GitRepo| repo.commit()), closure: Box::new(move |repo: &GitRepo| repo.commit()),
}, // FIXME doesn't take msg },
SeriesItem { SeriesItem {
operation: "push", operation: "push",
closure: Box::new(move |repo: &GitRepo| repo.push()), closure: Box::new(move |repo: &GitRepo| repo.push()),

View file

@ -43,7 +43,7 @@ mod utils;
use cli::{Args, Commands}; use cli::{Args, Commands};
use git::Config; use git::Config;
use utils::strings::QUICK_COMMIT; use utils::strings::{FAST_COMMIT, QUICK_COMMIT};
use clap::Parser; use clap::Parser;
@ -56,7 +56,7 @@ use log::{debug, error, info, trace, warn};
/// to the relavant operations. /// to the relavant operations.
fn main() { fn main() {
pretty_env_logger::init(); pretty_env_logger::init();
let args = Args::parse(); let mut args = Args::parse();
let config = Config::new(&args.config); let config = Config::new(&args.config);
match &args { match &args {
args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE), args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE),
@ -64,15 +64,27 @@ fn main() {
args if args.code_of_conduct => unimplemented!(), args if args.code_of_conduct => unimplemented!(),
_ => (), _ => (),
} }
match &args.command { match &mut args.command {
Some(Commands::Link { msg: _ }) => { Some(Commands::Link { msg: _ }) => {
config.link_all(); config.link_all();
} }
Some(Commands::Quick { msg }) => { Some(Commands::Quick { msg }) => {
config.quick(QUICK_COMMIT); let s = Box::leak(
msg.as_mut()
.get_or_insert(&mut QUICK_COMMIT.to_string())
.clone()
.into_boxed_str(),
);
config.quick(s);
} }
Some(Commands::Fast { msg }) => { Some(Commands::Fast { msg }) => {
config.fast(msg.as_ref().get_or_insert(&"gg: fast commit".to_string())); let s = Box::leak(
msg.as_mut()
.get_or_insert(&mut FAST_COMMIT.to_string())
.clone()
.into_boxed_str(),
);
config.fast(s);
} }
Some(Commands::Clone { msg: _ }) => { Some(Commands::Clone { msg: _ }) => {
config.clone_all(); config.clone_all();

View file

@ -1,4 +1,21 @@
categories: categories:
utils:
flags: []
repos:
li:
name: li
path: /home/ces/org/src/git/
url: git@github.com:cafkafk/li.git
flags:
- Clone
- Push
gg:
name: gg
path: /home/ces/.dots/
url: git@github.com:cafkafk/gg.git
flags:
- Clone
- Push
config: config:
flags: [] flags: []
repos: repos:
@ -16,23 +33,6 @@ categories:
flags: flags:
- Clone - Clone
- Push - Push
utils:
flags: []
repos:
gg:
name: gg
path: /home/ces/.dots/
url: git@github.com:cafkafk/gg.git
flags:
- Clone
- Push
li:
name: li
path: /home/ces/org/src/git/
url: git@github.com:cafkafk/li.git
flags:
- Clone
- Push
links: links:
- name: gg - name: gg
rx: /home/ces/.config/gg rx: /home/ces/.config/gg

View file

@ -46,5 +46,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
"; ";
/// Contains the message for quick commit subcommit /// Contains the message for quick commit subcommand
pub const QUICK_COMMIT: &'static str = "git: quick commit"; pub const QUICK_COMMIT: &str = "git: quick commit";
/// Contains the message for fast commit subcommand
pub const FAST_COMMIT: &str = "git: fast commit";