You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* chore: improve install script
- improved script to either install or update when version is lower than
release version.
* chore: update release-please github action
- deleted the scripts/build script
- moved the logic from the scripts/build script to the release-please
action
* chore: use defaults for go dependency checking
- removed settings for day, time, and timezone from dependency checking
for go mod
The dependabot now uses the default weekly time settings.
* chore: fix pre-commit git hook
- removed adding all files after running go formatter
This fixes issue of unwanted files/directories added to the commit.
* feat: add template subcommand
- created template subcommand for use with git hook templates (reusable
git hooks)
- created subcommands for template to create, copy, edit, and remove
templates.
* feat: add config subcommand
- created HkUp configuration settings
- created subcommands for config to get and set configuration settings
NOTE: this feature is hidden and will be available when configuration
settings are finalized.
* refactor(cmd): simplify flag handling & init logic
- Rename flags for consistency: `Lang` to `LangFlg`, `GitDir` to `GitDirFlg`, and `WorkTree` to `WorkTreeFlg`.
- Consolidate command registration in `root.go` by removing redundant `rootCmd.AddCommand` calls from individual command files (add.go, remove.go, list.go, doc.go).
- Simplify `init()` functions in command files to centralize logic.
- Update root command version handling to dynamically use `version` variable.
- Clarify documentation comment in `main.go`.
* refactor(logic): update flags and simplify hook commands
- Rename flags: `Lang` to `LangFlg`, `GitDir` to `GitDirFlg`, `WorkTree` to `WorkTreeFlg` for consistency.
- Simplify the Add, Remove, and Init logic by centralizing directory checks and reducing redundant code.
- Update file handling to improve readability and error handling.
- Adjust comments for better clarity and consistency across functions.
* refactor(git): improve comments and simplify hook logic
- Updated comments for clarity and consistency in the Git package.
- Removed unnecessary constant `HookDocSite`, and clarified hook documentation URL logic.
- Simplified the `GetHook` and `GetLang` functions to improve readability and error handling.
- Updated the `supportedLangs` map to explicitly include `sh` and `bash`, ensuring clearer intent.
* feat(util): add file ops, prompts, and config functions
- Added utility functions for terminal prompts, including YesNoPrompt and UserInputPrompt, to improve user interaction.
- Expanded file handling functions, including CreateDirectory and CopyFile, to support additional use cases.
- Introduced functions to handle HkUp configuration paths:
- GetConfigDirPath
- GetConfigFilePath
- GetTemplateDirPath
- Added functions for TOML file manipulation:
- GetTOMLValue (retrieve a value from a TOML file)
- SetTOMLValue (set a value in a TOML file)
- Implemented GetEditor function to determine the default editor for HkUp from configuration, git, or environment variables.
- Refactored existing functions for clarity and consistency (e.g., CreateFile, DoesDirectoryExist).
@@ -11,9 +11,16 @@ Your CLI tool with benefits built by [iton0](https://github.com/iton0) in [Go](h
11
11
## Introduction
12
12
Git hooks automate and implement processes in your workflow, increasing code quality and consistency.
13
13
14
-
However, many developers avoid git hooks due to a lack of awareness and the perceived complexity of setup, discouraging them from using this feature.
14
+
Common use cases include:
15
+
- Commit Message Validation
16
+
- Environment Configuration
17
+
- Formatting
18
+
- Linting
19
+
- Testing
15
20
16
-
**HkUp** simplifies the management of git hooks, allowing you to focus on the logic and usage of your hooks instead.
21
+
However, many developers avoid Git hooks due to a lack of awareness and the perceived complexity of setup, discouraging them from using this feature.
22
+
23
+
**HkUp** simplifies the management of Git hooks, allowing you to focus on the logic and usage of your hooks instead.
17
24
18
25
## Installation
19
26
External Dependencies:
@@ -27,10 +34,9 @@ Run the script below (supports Linux and macOS):
27
34
curl -sSL https://raw.githubusercontent.com/iton0/hkup-cli/main/scripts/install | sh
28
35
```
29
36
> [!Tip]
30
-
> To update HkUp, rerun the above script.
31
-
> It will replace the current version.
37
+
> To update HkUp, simply rerun the script above. It will automatically replace your current version with the latest release.
32
38
33
-
####Uninstalling hkup
39
+
### Uninstalling HkUp
34
40
35
41
```sh
36
42
# Locates and deletes the HkUp binary
@@ -40,49 +46,63 @@ sh -c 'rm "$(command -v 'hkup')"'
40
46
</details>
41
47
42
48
## Usage Quickstart
43
-
This section provides basic information about core usage. For detailed options run `hkup --help`.
49
+
This section provides basic information about core usage. For detailed usage information run `hkup --help`.
44
50
45
-
####Initializing hkup
51
+
### Initializing hkup
46
52
Run the following command in your git repository to initialize HkUp:
47
53
```sh
48
54
hkup init
49
55
```
50
56
51
-
This command creates a **.hkup**folder and sets the local **core.hooksPath** variable. If the folder already exists, it will simply update the path variable. The path is relative, ensuring that moving your repository won’t affect hook sourcing.
57
+
This creates a **.hkup**directory and sets the local **core.hooksPath** variable. If the directory already exists, it will simply update the path variable. The path is relative, ensuring that moving your repository won’t affect hook sourcing.
52
58
53
-
####Adding & Removing hooks
59
+
### Adding & Removing hooks
54
60
Add or remove hooks easily with:
55
61
```sh
56
62
hkup add <hook-name>
63
+
57
64
hkup remove <hook-name>
58
65
```
59
66
60
-
#### Info & Docs
61
-
There are two commands that will help you with both HkUp and git hooks:
62
-
63
-
**`hkup list {hook|lang}`**
64
-
Outputs list of either available hooks or supported languages.
67
+
### Templates
68
+
A **template** is a pre-configured, reusable Git hook that simplifies and automates the process of setting up hooks in a Git repository. With **HkUp**, you can create, copy, edit, or remove templates, allowing for consistent and easy application of hooks without needing to rewrite scripts each time.
65
69
66
-
**`hkup doc <hook-name>`**
67
-
Opens your browser with Git documentation for the specified git hook, helping you understand its usage.
70
+
The templates are stored in the HkUp config templates directory that can either be found at **$XDG_CONFIG_HOME/hkup/templates** or **$HOME/.config/hkup/templates** depending on your system.
68
71
69
-
##Future TODOs
70
-
-[ ] make an update subcommand
71
-
-[ ] store custom git hooks as templates for future use (via add template subcmd)
72
-
- Allow users to create, store, and share templates for common hooks. Users can fetch these templates over the network.
73
-
-[ ] branch-specific hooks
74
-
-[ ] logo maybe?
72
+
#### Naming Convention
73
+
Template files follow the naming convention:
74
+
`<template-name>#<hook-name>`
75
+
Where:
76
+
-`<template-name>` is the name of the template.
77
+
-`<hook-name>` is the specific Git hook (e.g., pre-commit, post-merge).
75
78
76
-
## Contributing
77
-
HkUp welcomes contributions to enhance this CLI application! Before submitting a pull request (PR) for a new feature, please follow these steps:
79
+
**Create a template**:
80
+
```sh
81
+
hkup template create
82
+
# OR
83
+
hkup template create <hook-name>
84
+
```
78
85
79
-
1.**Create an Issue**:
80
-
If you have an idea for a new feature, please create a new issue in the repository using the **feature_request** template. Provide a clear description of the feature and its potential benefits. Please note that issues submitted without using the template may be closed without warning.
86
+
**Copy a template** into current working directory:
87
+
```sh
88
+
hkup template copy <template-name>
89
+
```
81
90
82
-
2.**Wait for Approval**:
83
-
Once you submit your issue, I’ll review it and provide feedback. If I approve the feature request, I will let you know that you're free to proceed with your PR.
91
+
**Edit a template**:
92
+
```sh
93
+
hkup template edit <template-name>
94
+
```
95
+
>[!CAUTION]
96
+
> Editing a template will not update its copies.
84
97
85
-
3.**Submit Your PR**:
86
-
After receiving approval, you can create your PR. Be sure to reference the issue in your PR description.
98
+
**Remove a template**:
99
+
```sh
100
+
hkup template remove <template-name>
101
+
```
87
102
88
-
Please note that PRs submitted without prior approval through an issue may be closed without merging. This process helps us manage feature requests effectively and ensures that contributions align with the project’s goals.
103
+
## Roadmap to v1.0.0
104
+
1. windows support
105
+
2. wrapper for git init & clone and gh repo create & clone
106
+
3. HkUp logo (may or may not keep this one)
107
+
4. better test coverage
108
+
5. Allow users to create, store, and share templates. Users can fetch these templates over internet (may need to make another repo for this).
0 commit comments