resulgit 1.0.16 → 1.0.17
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.
- package/README.md +7 -4
- package/package.json +1 -1
- package/resulgit.js +15 -1
package/README.md
CHANGED
|
@@ -48,10 +48,13 @@ resulgit <command> [options]
|
|
|
48
48
|
### Branch Operations
|
|
49
49
|
|
|
50
50
|
- `resulgit branch list` - List all branches
|
|
51
|
-
- `resulgit branch create
|
|
52
|
-
- `resulgit branch
|
|
53
|
-
- `resulgit
|
|
54
|
-
- `resulgit
|
|
51
|
+
- `resulgit branch create <name>` - Create new branch (simple)
|
|
52
|
+
- `resulgit branch create <name> --base <branch>` - Create from specific base
|
|
53
|
+
- `resulgit branch delete <name>` - Delete a branch
|
|
54
|
+
- `resulgit switch <branch>` - Switch to a branch
|
|
55
|
+
- `resulgit switch -c <branch>` - Create and switch to new branch
|
|
56
|
+
- `resulgit checkout <branch>` - Checkout a branch
|
|
57
|
+
- `resulgit merge <branch>` - Merge a branch into current
|
|
55
58
|
|
|
56
59
|
### File Operations
|
|
57
60
|
|
package/package.json
CHANGED
package/resulgit.js
CHANGED
|
@@ -44,13 +44,15 @@ function parseArgs(argv) {
|
|
|
44
44
|
const key = t.slice(1)
|
|
45
45
|
const val = tokens[i + 1] && !tokens[i + 1].startsWith('-') ? tokens[++i] : 'true'
|
|
46
46
|
opts[key] = val
|
|
47
|
-
} else if (cmd.length <
|
|
47
|
+
} else if (cmd.length < 3) {
|
|
48
|
+
// Allow up to 3 positional args: e.g. 'branch create DevBranch'
|
|
48
49
|
cmd.push(t)
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
// Map short flags to long flags
|
|
52
53
|
if (opts.m && !opts.message) { opts.message = opts.m; delete opts.m }
|
|
53
54
|
if (opts.a && !opts.all) { opts.all = opts.a; delete opts.a }
|
|
55
|
+
if (opts.b && !opts.branch) { opts.branch = opts.b; delete opts.b }
|
|
54
56
|
return { cmd, opts }
|
|
55
57
|
}
|
|
56
58
|
|
|
@@ -3354,10 +3356,18 @@ async function main() {
|
|
|
3354
3356
|
return
|
|
3355
3357
|
}
|
|
3356
3358
|
if (cmd[0] === 'branch') {
|
|
3359
|
+
// Support positional: 'branch create DevBranch' or 'branch delete DevBranch'
|
|
3360
|
+
if ((cmd[1] === 'create' || cmd[1] === 'delete') && cmd[2] && !opts.name) {
|
|
3361
|
+
opts.name = cmd[2]
|
|
3362
|
+
}
|
|
3357
3363
|
await cmdBranch(cmd[1], opts)
|
|
3358
3364
|
return
|
|
3359
3365
|
}
|
|
3360
3366
|
if (cmd[0] === 'switch') {
|
|
3367
|
+
// Support positional: 'switch main' instead of 'switch --branch main'
|
|
3368
|
+
if (cmd[1] && !cmd[1].startsWith('-') && !opts.branch) {
|
|
3369
|
+
opts.branch = cmd[1]
|
|
3370
|
+
}
|
|
3361
3371
|
await cmdSwitch(opts)
|
|
3362
3372
|
return
|
|
3363
3373
|
}
|
|
@@ -3370,6 +3380,10 @@ async function main() {
|
|
|
3370
3380
|
return
|
|
3371
3381
|
}
|
|
3372
3382
|
if (cmd[0] === 'merge') {
|
|
3383
|
+
// Support positional: 'merge DevBranch' instead of 'merge --branch DevBranch'
|
|
3384
|
+
if (cmd[1] && !cmd[1].startsWith('-') && !opts.branch) {
|
|
3385
|
+
opts.branch = cmd[1]
|
|
3386
|
+
}
|
|
3373
3387
|
await cmdMerge(opts)
|
|
3374
3388
|
return
|
|
3375
3389
|
}
|