gitbash 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +15 -0
  2. package/bin/gitbash +46 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -16,6 +16,7 @@ npm i -g gitbash
16
16
  gitbash --help # Show help
17
17
  gitbash --version # Show version
18
18
  gitbash --init # Print shell init code
19
+ gitbash --config # Interactive configuration wizard
19
20
  ```
20
21
 
21
22
  ### Shell Aliases
@@ -56,6 +57,20 @@ brew install git-delta # Better diff highlighting
56
57
  brew install bat # File preview with syntax highlighting
57
58
  ```
58
59
 
60
+ ### Configuration
61
+
62
+ gitbash reads configuration from `~/.gitbashrc` if it exists. You can set the following variables:
63
+
64
+ ```bash
65
+ # Prefix for feature branches (default: "feature/")
66
+ GITBASH_FEATURE_BRANCH_PREFIX="feature/"
67
+
68
+ # Command for merging (default: "merge")
69
+ GITBASH_MERGE_COMMAND="merge"
70
+ ```
71
+
72
+ You can create this file manually or use `gitbash --config` to configure interactively.
73
+
59
74
  ## Commands
60
75
 
61
76
  ### branch
package/bin/gitbash CHANGED
@@ -3,6 +3,42 @@
3
3
 
4
4
  set -euo pipefail
5
5
 
6
+ CONFIG_FILE="$HOME/.gitbashrc"
7
+
8
+ load_config() {
9
+ if [[ -f "$CONFIG_FILE" ]]; then
10
+ # shellcheck disable=SC1090
11
+ source "$CONFIG_FILE"
12
+ fi
13
+ }
14
+
15
+ configure_gitbash() {
16
+ load_config
17
+
18
+ local current_prefix="${GITBASH_FEATURE_BRANCH_PREFIX:-feature/}"
19
+ local current_merge="${GITBASH_MERGE_COMMAND:-fork}"
20
+
21
+ echo "Configure gitbash (writes to $CONFIG_FILE)"
22
+
23
+ local input prefix merge_cmd
24
+
25
+ read -e -p "Feature branch prefix (used by create) [${current_prefix}]: " input
26
+ prefix=${input:-$current_prefix}
27
+
28
+ read -e -p "Merge tool command (used by update on conflicts) [${current_merge}]: " input
29
+ merge_cmd=${input:-$current_merge}
30
+
31
+ cat > "$CONFIG_FILE" <<EOF
32
+ # gitbash configuration
33
+ # Prefix for feature branches created by 'create'
34
+ GITBASH_FEATURE_BRANCH_PREFIX="$prefix"
35
+ # Merge tool command invoked by 'update' when conflicts occur
36
+ GITBASH_MERGE_COMMAND="$merge_cmd"
37
+ EOF
38
+
39
+ echo "Saved configuration to $CONFIG_FILE"
40
+ }
41
+
6
42
  # Resolve symlinks to get the actual script location
7
43
  SOURCE="${BASH_SOURCE[0]}"
8
44
  while [[ -L "$SOURCE" ]]; do
@@ -38,9 +74,10 @@ show_help() {
38
74
  gitbash - Interactive git utilities for bash
39
75
 
40
76
  Usage:
41
- gitbash <command> [args...]
42
- gitbash --help
43
- gitbash --init
77
+ gitbash <command> [args...]
78
+ gitbash --help
79
+ gitbash --init
80
+ gitbash --config
44
81
 
45
82
  Commands:
46
83
  branch Interactive menu for branch operations
@@ -62,6 +99,7 @@ Options:
62
99
  -h, --help Show this help message
63
100
  -v, --version Show version number
64
101
  --init Print shell initialization code (for sourcing)
102
+ --config Configure gitbash and save to ~/.gitbashrc
65
103
 
66
104
  Examples:
67
105
  gitbash commit fix bug -p # Commit and push
@@ -102,6 +140,7 @@ EOF
102
140
 
103
141
  # Main entry point
104
142
  main() {
143
+ load_config
105
144
  case "${1:-}" in
106
145
  -h|--help|"")
107
146
  show_help
@@ -115,6 +154,10 @@ main() {
115
154
  show_init
116
155
  exit 0
117
156
  ;;
157
+ --config)
158
+ configure_gitbash
159
+ exit 0
160
+ ;;
118
161
  *)
119
162
  local cmd="$1"
120
163
  shift
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",