Skip to content
This repository was archived by the owner on Aug 11, 2025. It is now read-only.

Commit a5c7738

Browse files
committed
feat(git): Copy functionality from tbdflow for git commands
1 parent 0e40b28 commit a5c7738

9 files changed

Lines changed: 447 additions & 0 deletions

File tree

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/check-commit.iml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.lock

Lines changed: 282 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "check-commit"
3+
version = "0.1.0"
4+
authors = ["Claes Adamsson <claes.adamsson@gmail.com>"]
5+
repository = "https://github.com/cladam/check-commit"
6+
readme="README.md"
7+
license = "MIT"
8+
description = "A TBD-friendly pre-commit tool that enforces your team's Definition of Done using an interactive checklist."
9+
keywords = ["git", "cli", "dod", "tbd"]
10+
categories = ["command-line-utilities", "development-tools"]
11+
edition = "2021"
12+
13+
[dependencies]
14+
clap = { version = "4.5.41", features = ["derive"] }
15+
thiserror = "2.0.12"
16+
anyhow = "1.0.98"
17+
colored = "3.0.0"

src/cli.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
use anyhow::{Context, Result};
2+
use clap::{Command, CommandFactory, Parser, Subcommand};
3+
use colored::*;
4+
use std::io::Write;
5+
use thiserror::Error;
6+
7+
/// A CLI to streamline your Git workflow for Trunk-Based Development
8+
#[derive(Parser, Debug)]
9+
#[command(author, version, about, long_about = None)]
10+
#[command(propagate_version = true)]
11+
struct Cli {
12+
#[command(subcommand)]
13+
command: Commands,
14+
}
15+
16+
#[derive(clap::Subcommand, Debug)]
17+
enum Commands {
18+
/// Show the current Git status
19+
Status,
20+
/// Commits changes to the current branch or 'main' if no branch is checked out.
21+
#[command(after_help = "Use the imperative, present tense: \"change\" not \"changed\". Think of This commit will...\n\
22+
COMMON COMMIT TYPES:\n \
23+
feat: A new feature for the user.\n \
24+
fix: A bug fix for the user.\n \
25+
chore: Routine tasks, maintenance, dependency updates.\n \
26+
docs: Documentation changes.\n \
27+
style: Code style changes (formatting, etc).\n \
28+
refactor: Code changes that neither fix a bug nor add a feature.\n \
29+
test: Adding or improving tests.\n\n\
30+
EXAMPLES:\n \
31+
check-commit commit --type \"feat\" --scope api -m \"Add user endpoint\"")]
32+
Commit {
33+
/// Commit type (e.g. 'feat', 'fix', 'chore', 'docs').
34+
#[arg(short, long)]
35+
r#type: String,
36+
/// Optional scope of the commit.
37+
#[arg(short, long)]
38+
scope: Option<String>,
39+
/// The descriptive commit message.
40+
#[arg(short, long)]
41+
message: String,
42+
},
43+
}

0 commit comments

Comments
 (0)