chore(version): bump to v0.1.2 #9
11 changed files with 139 additions and 57 deletions
28
CHANGELOG.md
28
CHANGELOG.md
|
@ -2,6 +2,30 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.1.2] - 2023-07-03
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Implemented quiet flag
|
||||||
|
|
||||||
|
## [0.1.1] - 2023-07-03
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
- Fixed help formatting
|
||||||
|
|
||||||
|
### Documentation
|
||||||
|
|
||||||
|
- Added asciinema demo
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- Added no-emoji flag
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Bump to v0.1.1
|
||||||
|
|
||||||
## [0.1.0] - 2023-07-03
|
## [0.1.0] - 2023-07-03
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
@ -16,6 +40,10 @@ All notable changes to this project will be documented in this file.
|
||||||
- Made SUCCESS/FAILURE emoji const
|
- Made SUCCESS/FAILURE emoji const
|
||||||
- Added flag no-emoji
|
- Added flag no-emoji
|
||||||
|
|
||||||
|
### Miscellaneous Tasks
|
||||||
|
|
||||||
|
- Bump v0.1.0, housekeeping
|
||||||
|
|
||||||
### Refactor
|
### Refactor
|
||||||
|
|
||||||
- Made code more idiomatic
|
- Made code more idiomatic
|
||||||
|
|
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -179,7 +179,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gg"
|
name = "gg"
|
||||||
version = "0.1.0"
|
version = "0.1.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"clap_mangen",
|
"clap_mangen",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "gg"
|
name = "gg"
|
||||||
version = "0.1.0"
|
version = "0.1.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Christina Sørensen"]
|
authors = ["Christina Sørensen"]
|
||||||
repository = "https://github.com/cafkafk/gg"
|
repository = "https://github.com/cafkafk/gg"
|
||||||
|
|
|
@ -7,6 +7,8 @@ with "dotfiles", and with git support as a first class feature. Configuration is
|
||||||
done throug a single yaml file, giving it a paradigm that should bring joy to
|
done throug a single yaml file, giving it a paradigm that should bring joy to
|
||||||
those that use declarative operating systems and package managers.
|
those that use declarative operating systems and package managers.
|
||||||
|
|
||||||
|
#+HTML: <a href="https://asciinema.org/a/TVmnEYR3PK40GtoZnwavun0dP" target="_blank"><img src="https://asciinema.org/a/TVmnEYR3PK40GtoZnwavun0dP.svg" /></a>
|
||||||
|
|
||||||
Although this isn't really a case where it matters *that* much for performance,
|
Although this isn't really a case where it matters *that* much for performance,
|
||||||
being written in rust instead of e.g. /janky/ scripting languages does also mean
|
being written in rust instead of e.g. /janky/ scripting languages does also mean
|
||||||
it is snappy and reliable, and the /extensive/ (hardly, but eventually) testing
|
it is snappy and reliable, and the /extensive/ (hardly, but eventually) testing
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
* 0.2.0 (maybe)
|
* 0.2.0 (maybe)
|
||||||
- [ ] Links in categories?
|
- [ ] Links in categories?
|
||||||
* 0.1.2
|
* 0.1.2
|
||||||
- [ ] Implement Quiet flag
|
- [X] Implement Quiet flag
|
||||||
* 0.1.1
|
* 0.1.1
|
||||||
- [ ] Implement no-emoji flag
|
- [X] Implement no-emoji flag
|
||||||
* 0.1.0 [100%] [5/5]
|
* 0.1.0 [100%] [5/5]
|
||||||
- [X] No functionality regressions
|
- [X] No functionality regressions
|
||||||
- [X] commit works in quick, fast
|
- [X] commit works in quick, fast
|
||||||
|
|
11
src/cli.rs
11
src/cli.rs
|
@ -24,13 +24,14 @@ use clap::{ArgAction, CommandFactory, Parser, Subcommand};
|
||||||
const CONFIG_FILE: &str = "/.config/gg/config.yaml";
|
const CONFIG_FILE: &str = "/.config/gg/config.yaml";
|
||||||
|
|
||||||
const HELP_TEMPLATE: &str = "\
|
const HELP_TEMPLATE: &str = "\
|
||||||
{before-help}{name} {version}
|
{before-help}{name} {version}
|
||||||
{author-with-newline}{about-with-newline}
|
{about-with-newline}
|
||||||
{usage-heading} {usage}
|
|
||||||
|
|
||||||
{all-args}{after-help}
|
{usage-heading} {usage}
|
||||||
|
|
||||||
";
|
{all-args}{after-help}
|
||||||
|
|
||||||
|
";
|
||||||
|
|
||||||
//#[clap(author, version, about, long_about = None)]
|
//#[clap(author, version, about, long_about = None)]
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
|
43
src/git.rs
43
src/git.rs
|
@ -25,7 +25,8 @@ use std::os::unix::fs::symlink;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::{fs, process::Command};
|
use std::{fs, process::Command};
|
||||||
|
|
||||||
use crate::utils::strings::{FAILURE_EMOJI, SUCCESS_EMOJI};
|
use crate::settings;
|
||||||
|
use crate::utils::strings::{failure_str, success_str};
|
||||||
|
|
||||||
/// An enum containing flags that change behaviour of repos and categories
|
/// An enum containing flags that change behaviour of repos and categories
|
||||||
#[derive(PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
#[derive(PartialOrd, Ord, PartialEq, Eq, Serialize, Deserialize, Debug)]
|
||||||
|
@ -349,11 +350,15 @@ impl Config {
|
||||||
{
|
{
|
||||||
for category in self.categories.values() {
|
for category in self.categories.values() {
|
||||||
for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
|
for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() {
|
||||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
|
||||||
if f(repo) {
|
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
if f(repo) {
|
||||||
|
sp.stop_and_persist(success_str(), format!("{}: {}", repo.name, op));
|
||||||
|
} else {
|
||||||
|
sp.stop_and_persist(failure_str(), format!("{}: {}", repo.name, op));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
f(repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,12 +410,17 @@ impl Config {
|
||||||
for instruction in &closures {
|
for instruction in &closures {
|
||||||
let f = &instruction.closure;
|
let f = &instruction.closure;
|
||||||
let op = instruction.operation;
|
let op = instruction.operation;
|
||||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
|
||||||
if f(repo) {
|
let mut sp =
|
||||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||||
|
if f(repo) {
|
||||||
|
sp.stop_and_persist(success_str(), format!("{}: {}", repo.name, op));
|
||||||
|
} else {
|
||||||
|
sp.stop_and_persist(failure_str(), format!("{}: {}", repo.name, op));
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
f(repo);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,11 +461,16 @@ impl Config {
|
||||||
for instruction in &closures {
|
for instruction in &closures {
|
||||||
let f = &instruction.closure;
|
let f = &instruction.closure;
|
||||||
let op = instruction.operation;
|
let op = instruction.operation;
|
||||||
let mut sp = Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
if !settings::QUIET.load(std::sync::atomic::Ordering::Relaxed) {
|
||||||
if f(repo) {
|
let mut sp =
|
||||||
sp.stop_and_persist(SUCCESS_EMOJI, format!("{}: {}", repo.name, op));
|
Spinner::new(Spinners::Dots10, format!("{}: {}", repo.name, op));
|
||||||
|
if f(repo) {
|
||||||
|
sp.stop_and_persist(success_str(), format!("{}: {}", repo.name, op));
|
||||||
|
} else {
|
||||||
|
sp.stop_and_persist(failure_str(), format!("{}: {}", repo.name, op));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sp.stop_and_persist(FAILURE_EMOJI, format!("{}: {}", repo.name, op));
|
f(repo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,8 @@ mod cli;
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
mod git;
|
mod git;
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
|
mod settings;
|
||||||
|
#[allow(unused)]
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
use cli::{Args, Commands};
|
use cli::{Args, Commands};
|
||||||
|
@ -50,6 +52,8 @@ use clap::Parser;
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
use log::{debug, error, info, trace, warn};
|
use log::{debug, error, info, trace, warn};
|
||||||
|
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
/// The main loop of the binary
|
/// The main loop of the binary
|
||||||
///
|
///
|
||||||
/// Here, we handle parsing the configuration file, as well as matching commands
|
/// Here, we handle parsing the configuration file, as well as matching commands
|
||||||
|
@ -62,7 +66,8 @@ fn main() {
|
||||||
args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE),
|
args if args.license => println!("{}", utils::strings::INTERACTIVE_LICENSE),
|
||||||
args if args.warranty => println!("{}", utils::strings::INTERACTIVE_WARRANTY),
|
args if args.warranty => println!("{}", utils::strings::INTERACTIVE_WARRANTY),
|
||||||
args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC),
|
args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC),
|
||||||
args if args.quiet => todo!(),
|
args if args.quiet => settings::QUIET.store(true, Ordering::Relaxed),
|
||||||
|
args if args.no_emoji => settings::EMOJIS.store(true, Ordering::Relaxed),
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
match &mut args.command {
|
match &mut args.command {
|
||||||
|
|
5
src/settings.rs
Normal file
5
src/settings.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
use std::sync::atomic::AtomicBool;
|
||||||
|
|
||||||
|
pub static QUIET: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
|
pub static EMOJIS: AtomicBool = AtomicBool::new(false);
|
|
@ -1,32 +1,4 @@
|
||||||
categories:
|
categories:
|
||||||
utils:
|
|
||||||
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
|
|
||||||
empty: {}
|
|
||||||
stuff:
|
|
||||||
flags: []
|
|
||||||
repos:
|
|
||||||
li:
|
|
||||||
name: li
|
|
||||||
path: /home/ces/org/src/git/
|
|
||||||
url: git@github.com:cafkafk/li.git
|
|
||||||
gg:
|
|
||||||
name: gg
|
|
||||||
path: /home/ces/.dots/
|
|
||||||
url: git@github.com:cafkafk/gg.git
|
|
||||||
config:
|
config:
|
||||||
flags: []
|
flags: []
|
||||||
repos:
|
repos:
|
||||||
|
@ -44,6 +16,34 @@ categories:
|
||||||
flags:
|
flags:
|
||||||
- Clone
|
- Clone
|
||||||
- Push
|
- Push
|
||||||
|
stuff:
|
||||||
|
flags: []
|
||||||
|
repos:
|
||||||
|
li:
|
||||||
|
name: li
|
||||||
|
path: /home/ces/org/src/git/
|
||||||
|
url: git@github.com:cafkafk/li.git
|
||||||
|
gg:
|
||||||
|
name: gg
|
||||||
|
path: /home/ces/.dots/
|
||||||
|
url: git@github.com:cafkafk/gg.git
|
||||||
|
utils:
|
||||||
|
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
|
||||||
|
empty: {}
|
||||||
links:
|
links:
|
||||||
- name: gg
|
- name: gg
|
||||||
rx: /home/ces/.config/gg
|
rx: /home/ces/.config/gg
|
||||||
|
|
|
@ -19,14 +19,18 @@
|
||||||
//! Ideally, at a VERY long term scale, this should be a nice pattern for
|
//! Ideally, at a VERY long term scale, this should be a nice pattern for
|
||||||
//! possible translations.
|
//! possible translations.
|
||||||
|
|
||||||
|
use std::sync::atomic::Ordering;
|
||||||
|
|
||||||
|
use crate::settings;
|
||||||
|
|
||||||
/// Contains the notice for interactive programs from the GPLv3's "How to Apply
|
/// Contains the notice for interactive programs from the GPLv3's "How to Apply
|
||||||
/// These Terms to Your New Programs"
|
/// These Terms to Your New Programs"
|
||||||
pub const INTERACTIVE_NOTICE: &str = "\
|
pub const INTERACTIVE_NOTICE: &str = "\
|
||||||
gg Copyright (C) 2023 Christina Sørensen <christina@cafkafk.com>
|
gg Copyright (C) 2023 Christina Sørensen <cafkafk.com>
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `gg --warranty'.
|
|
||||||
This is free software, and you are welcome to redistribute it
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `gg
|
||||||
under certain conditions; type `gg --license' for details.
|
--warranty'. This is free software, and you are welcome to redistribute it under
|
||||||
";
|
certain conditions; type `gg --license' for details. ";
|
||||||
|
|
||||||
/// Contains the license part of the long notice for interactive programs from
|
/// Contains the license part of the long notice for interactive programs from
|
||||||
/// the GPLv3's "How to Apply These Terms to Your New Programs"
|
/// the GPLv3's "How to Apply These Terms to Your New Programs"
|
||||||
|
@ -65,3 +69,25 @@ pub const SUCCESS_EMOJI: &str = "✔";
|
||||||
|
|
||||||
/// Failure emoji
|
/// Failure emoji
|
||||||
pub const FAILURE_EMOJI: &str = "❌";
|
pub const FAILURE_EMOJI: &str = "❌";
|
||||||
|
|
||||||
|
/// Success string
|
||||||
|
pub const SUCCESS_STRING: &str = "SUCC";
|
||||||
|
|
||||||
|
/// Failure string
|
||||||
|
pub const FAILURE_STRING: &str = "FAIL";
|
||||||
|
|
||||||
|
pub fn success_str() -> &'static str {
|
||||||
|
if !settings::EMOJIS.load(Ordering::Relaxed) {
|
||||||
|
SUCCESS_EMOJI
|
||||||
|
} else {
|
||||||
|
SUCCESS_STRING
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn failure_str() -> &'static str {
|
||||||
|
if !settings::EMOJIS.load(Ordering::Relaxed) {
|
||||||
|
FAILURE_EMOJI
|
||||||
|
} else {
|
||||||
|
FAILURE_STRING
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue