sugarjar 3.0.0 → 4.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0359bbf05d9c9930fb303ddcba57fd651d00de7ce046a5640c77f596fa148531'
4
- data.tar.gz: 6a505ebcdc042fb4e3b6bd6c4e55e85401787f748a1f8874b4fd18e7489600e7
3
+ metadata.gz: d8993339f3317f275721220d1b548fa4253180783483c4ea0d1a69080b25b6f1
4
+ data.tar.gz: 05ca92916f85edd2e1f5657aebc9e8fa50404a7ab22c973bc22bcae2bd932928
5
5
  SHA512:
6
- metadata.gz: 88050a2cc342cac84d22ed6395f5fa36df8ff98361283408ae227611c4814b23881ae4a59eef276feb160bea04c9b84e81d6cd76d7eae0c8d8caac0e199dcdad
7
- data.tar.gz: 932d4c9918a3eb50c078e6e3a7dd4728ea648cca222daa460954ec51ea7109fc374ea8a8517e9cf1b71d900ac5bb44c4a6120f0a7aaa581fee87d154a6be08f7
6
+ metadata.gz: 1d1317871412a3a251cf5c5f5b456db154dc672cdbacb7475d8486ac57c8ec87ad9b5ff5daf5814bd5e9ad94b0b987f1a072c6635d713061c9d297fe0edea460
7
+ data.tar.gz: b70c9c903409db5c277752b746e6b108568434c6d95b61a7d3bb2d3fb483fc66966d14ade23bee067805212ad28d485ca928b2441d67d06b36b58468ed982e21
data/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # SugarJar Changelog
2
2
 
3
+ ## 4.0.0 (2026-08-09)
4
+
5
+ * Rework config file format to be more friendly to working with multiple forges
6
+ * Add `modernizeconfig` command to help users migrate to new config file format
7
+ * Various improvements to gitlab compatibility
8
+ * Fix bugs around repo name detection when directory name doesn't match
9
+ * Revamp `help` to be easier to read and navigate
10
+ * Add support for Forgejo/Codeberg forges
11
+ * Update repoconfig format to allow specifying names for checks
12
+
13
+ ## 3.0.1 (2026-06-19)
14
+
15
+ * Update tests for more resiliency in various package-building environments
16
+ * Better fallbacks for forge type
17
+ * Add config option to disable fork-based flows
18
+ * Fix false-positive for "primary branch doesn't match" error
19
+ * gitlab: Handle 3-level repos better
20
+ * gitlab: Fix `smartpullrequest` issues
21
+ * gitlab: significant improvement to `smartclone`
22
+ * Add `--fork-name` option to enable forking to a different repo name
23
+
3
24
  ## 3.0.0 (2026-06-08)
4
25
 
5
26
  * Add support for GitLab
data/README.md CHANGED
@@ -30,6 +30,10 @@ If you don't, there's a ton of useful stuff for everyone!
30
30
 
31
31
  Jump to what you're most interested in:
32
32
 
33
+ > [!NOTE]
34
+ > There is a new 'modernizeconfig' option to automatically convert your
35
+ > config for the significant changes in 4.x.
36
+
33
37
  * [Common Use-cases](#common-use-cases)
34
38
  * [Auto Cleanup Squash-merged branches](#auto-cleanup-squash-merged-branches)
35
39
  * [Smarter clones and remotes](#smarter-clones-and-remotes)
@@ -59,12 +63,16 @@ Jump to what you're most interested in:
59
63
 
60
64
  ### Auto cleanup squash-merged branches
61
65
 
66
+ <details>
67
+
68
+ <summary>Clean-up squash-merged PRs safely and easily</summary>
69
+
62
70
  It is common for a PR to go back and forth with a variety of nits, lint fixes,
63
71
  typos, etc. that can muddy history. So many projects will "squash and merge"
64
- when they accept a pull request. However, that means `git branch -d <branch>`
65
- doesn't work. Git will tell you the branch isn't fully merged. You can, of
66
- course `git branch -D <branch>`, but that does no safety checks at all, it
67
- forces the deletion.
72
+ when they accept a pull request. However, that means `git branch -d
73
+ BRANCH` doesn't work. Git will tell you the branch isn't fully merged.
74
+ You can, of course `git branch -D BRANCH`, but that does no safety
75
+ checks at all, it forces the deletion.
68
76
 
69
77
  Enter `sj lbclean` - it determines if the contents of your branch has been merge
70
78
  and safely deletes if so. (Note: `lbclean` stands for "local branch clean", and
@@ -78,7 +86,7 @@ https://github.com/jaymzh/sugarjar/blob/main/images/bclean.png
78
86
  Will delete a branch, if it has been merged, **even if it was squash-merged**.
79
87
 
80
88
  You can pass it a branch if you'd like (it defaults to the branch you're on):
81
- `sj bclean <branch>`.
89
+ `sj bclean BRANCH`.
82
90
 
83
91
  But it gets better! You can use `sj bcleanall` to remove all branches that have
84
92
  been merged:
@@ -100,9 +108,14 @@ There is even `sj gbclean` ("global branch clean") (and `sj gbcleanall`) which
100
108
  will do both the local and remote cleaning.
101
109
 
102
110
  *NOTE*: Remote branch cleaning is still experimental, use with caution!
111
+ </details>
103
112
 
104
113
  ### Smarter clones and remotes
105
114
 
115
+ <details>
116
+
117
+ <summary>Fork, clone, and add the upstream remote automatically</summary>
118
+
106
119
  There's a pattern to every new repo we want to contribute to. First we fork,
107
120
  then we clone the fork, then we add a remote of the upstream repo. It's
108
121
  monotonous. SugarJar does this for you:
@@ -115,19 +128,40 @@ https://github.com/jaymzh/sugarjar/blob/main/images/sclone.png
115
128
 
116
129
  This will:
117
130
 
118
- * Fork the repo to your personal org (if you don't already have a fork)
131
+ * Fork the repo to your personal org (if you don't already have a fork,
132
+ and if it's not already in your personal org)
119
133
  * Clone your fork
120
134
  * Add the original as an 'upstream' remote
121
135
 
122
- Note that it takes short names for repos. No need to specify a full URL,
123
- just a $org/$repo.
136
+ Note that if you pass in a full-formed URL (like
137
+ `git@github.com:chef/omnibus-toolchain.git`), SugarJar will infer the host and
138
+ the forge type (gitub, gitlab, etc.). However, it does accept short names for
139
+ repos ($org/$repo) - however, for cloning, since there is no repo yet for
140
+ SugarJar to determine the forge from, you will need either to specify
141
+ `--default-forge-host`, or have `default_forge_host` set in your config file.
124
142
 
125
143
  Like `git clone`, `sj smartclone` will accept an additional argument as the
126
144
  destination directory to clone to. It will also pass any other unknown options
127
145
  to `git clone` under the hood.
128
146
 
147
+ If you don't work with fork-based workflows, you can set `use_forks: false`
148
+ in your config for the right host:
149
+
150
+ ```yaml
151
+ host_configs:
152
+ default:
153
+ use_forks: false
154
+ ```
155
+
156
+ See [Configuration](#Configuration) for more details on the config file.
157
+ </details>
158
+
129
159
  ### Work with stacked branches more easily
130
160
 
161
+ <details>
162
+
163
+ <summary>Create and manage stacked/dependent branches easily</summary>
164
+
131
165
  It's important to break changes into reviewable chunks, but working with
132
166
  stacked branches can be confusing. SugarJar provides several tools to make this
133
167
  easier.
@@ -223,9 +257,14 @@ https://github.com/jaymzh/sugarjar/blob/main/images/subfeature-detect-missing-ba
223
257
 
224
258
  SugarJar detects that branch is gone and thus this branch should now be based
225
259
  on the upstream main branch!
260
+ </details>
226
261
 
227
262
  ### Creating Stacked PRs with subfeatures
228
263
 
264
+ <details>
265
+
266
+ <summary>Automatically base PRs for subfeatures on their parent branch</summary>
267
+
229
268
  When dependent branches are created with `subfeature`, when you create a PR,
230
269
  SugarJar will automatically set the 'base' of the PR to the parent branch. By
231
270
  default it'll prompt you about this, but you can set `pr_autostack` to `true`
@@ -238,8 +277,14 @@ It looks like this is a subfeature, would you like to base this PR on mynewthing
238
277
  ...
239
278
  ```
240
279
 
280
+ </details>
281
+
241
282
  ### Smart release branch handling
242
283
 
284
+ <details>
285
+
286
+ <summary>Configure and protect long-lived release branches</summary>
287
+
243
288
  You can tell sugar what release branches exist, and it will intelligently
244
289
  handle them. So of you specify, in your repoconfig:
245
290
 
@@ -255,9 +300,14 @@ Then:
255
300
  to `upstream/v2-branch` (or `origin/v2-branch` as appropriate)
256
301
  * `sj lbclean`/`sj lbcleanall` (of all varieties) will never reap release
257
302
  branches
303
+ </details>
258
304
 
259
305
  ### Have a better lint/unittest experience!
260
306
 
307
+ <details>
308
+
309
+ <summary>Run lint and unittests automatically before pushing</summary>
310
+
261
311
  Ever made a PR, only to find out later that it failed tests because of some
262
312
  small lint issue? Not anymore! SJ can be configured to run things before
263
313
  pushing. For example,in the SugarJar repo, we have it run Rubocop (ruby lint)
@@ -286,15 +336,25 @@ sj smartpush # or spush
286
336
 
287
337
  Run configured push-time actions (nothing, lint, unit, both), and do not
288
338
  push if any of them fail.
339
+ </details>
289
340
 
290
341
  ### Better push defaults
291
342
 
343
+ <details>
344
+
345
+ <summary>Smart defaults for `smartpush`</summary>
346
+
292
347
  In addition to running pre-push tests for you `smartpush` also picks smart
293
348
  defaults for push. So if you `sj spush` with no arguments, it uses the
294
349
  `origin` remote and the same branch name you're on as the remote branch.
350
+ </details>
295
351
 
296
352
  ### Cleaning up your own history
297
353
 
354
+ <details>
355
+
356
+ <summary>Safely amend commits and force-push with `amend`/`fpush`</summary>
357
+
298
358
  Perhaps you contribute to a project that prefers to use merge commits, so you
299
359
  like to clean up your own history. This is often difficult to get right - a
300
360
  combination of rebases, amends and force pushes. We provide two commands here
@@ -312,9 +372,14 @@ sure you're up-to-date with the remote before forcing the push. But man that
312
372
  command is a mouthful! Enter `sj fpush`. It has all the smarts of `sj
313
373
  smartpush` (runs configured pre-push actions), but adds `--force-with-lease` to
314
374
  the command!
375
+ </details>
315
376
 
316
377
  ### Better feature branches
317
378
 
379
+ <details>
380
+
381
+ <summary>Create feature branches with the right base and prefix</summary>
382
+
318
383
  When you want to start a new feature, you want to start developing against
319
384
  latest. That's why `sj feature` defaults to creating a branch against what we
320
385
  call "most master". That is, `upstream/master` if it exists, otherwise
@@ -343,17 +408,36 @@ e.g. `$USER/`.
343
408
  For example, if your prefix was `user/`, then `sj feature foo` would create
344
409
  `user/foo`, and `sj co foo` would switch to `user/foo`.
345
410
 
411
+ Here's an example:
412
+
413
+ ```yaml
414
+ host_configs:
415
+ default:
416
+ feature_prefix: "jsmith/"
417
+ ```
418
+
419
+ </details>
420
+
346
421
  ### Smartlog
347
422
 
423
+ <details>
424
+
425
+ <summary>Visualize your branch tree</summary>
426
+
348
427
  Smartlog will show you a tree diagram of your branches! Simply run `sj
349
428
  smartlog` or `sj sl` for short.
350
429
 
351
430
  ![smartlog screenshot](
352
431
  https://github.com/jaymzh/sugarjar/blob/main/images/smartlog.png
353
432
  )
433
+ </details>
354
434
 
355
435
  ### Sync work across workstations
356
436
 
437
+ <details>
438
+
439
+ <summary>Keep branches in sync across multiple machines</summary>
440
+
357
441
  If you work on multiple workstations, keeping your branches in-sync can be a
358
442
  pain. SugarJar provides `sync` to help with this.
359
443
 
@@ -366,19 +450,50 @@ from `origin/foo`. If you have local changes, that are not already on
366
450
 
367
451
  It's very similar to `sj up`, but instead of rebasing on top of the tracking
368
452
  branch, it rebases on top of the push target branch.
453
+ </details>
369
454
 
370
455
  ### Pulling in suggestions from the web
371
456
 
457
+ <details>
458
+
459
+ <summary>Merge in GitHub/GitLab suggested changes</summary>
460
+
372
461
  When someone 'suggests' a change in the GH/GL WebUI, once you choose to commit
373
462
  them, your origin and local branches are no longer in-sync. The
374
463
  `pullsuggestions` command will attempt to merge in any remote commits to your
375
464
  local branch. This command will show a diff and ask for confirmation before
376
465
  attempting the merge and - if allowed to continue - will use a fast-forward
377
466
  merge.
467
+ </details>
468
+
469
+ ### Modernize your config
470
+
471
+ <details>
472
+
473
+ <summary>Convert your old config to the new `host_configs` format</summary>
474
+
475
+ In 4.0, we significantly revamped how the configuration works, adding the new
476
+ `host_configs` section, and deprecating or moving many top-level configs. In
477
+ order to make this transition easier, there is now a `modernizeconfig` command
478
+ to convert it for you!
479
+
480
+ ```shell
481
+ sj modernizeconfig ~/.config/sugarjar/config.yml
482
+ ```
483
+
484
+ This will generate a new config for you, show you a diff, and offer to either
485
+ update the existing file, or save it off the side for you.
486
+
487
+ </details>
378
488
 
379
489
  ### And more!
380
490
 
491
+ <details>
492
+
493
+ <summary>There's even more than this!</summary>
494
+
381
495
  See `sj help` for more commands!
496
+ </details>
382
497
 
383
498
  ## Installation
384
499
 
@@ -450,24 +565,18 @@ prone, so this setting will automatically set this up for each developer.
450
565
  Like `gh` and `glab`, SugarJar supports Enterprise versions of GitHub and
451
566
  GitLab. In fact, we provide extra features just for it.
452
567
 
453
- In most cases, when using `sj smartclone`, pass in `--forge-host`, and
454
- that's about all you need, everything else should be handlded automagically.
455
-
456
- However, you can set `forge_host` in your global or user config, but since most
457
- users will also have a few opensource repos, you can override it in the
458
- Repository Config as well.
568
+ By default, SugarJar will pick up the appropriate information from the repo
569
+ itself, so the only real interesting part is `smartclone`. In most cases,
570
+ SugarJar will automatically determine the proper forge-host based on the URL
571
+ you pass in. However, if you use short names ("repo/org" or
572
+ "company/repo/org"), then you can either pass in `--default-forge-host`, or, if
573
+ you want to always default to a given host, you can set a top-level
574
+ `default_forge_host` in your SugarJar config:
459
575
 
460
576
  So, for example you might have:
461
577
 
462
578
  ```yaml
463
- forge_host: gh.sample.com
464
- ```
465
-
466
- In your `~/.config/sugarjar/config.yaml`, but if the `.sugarjar.yaml` in your
467
- repo has:
468
-
469
- ```yaml
470
- forge_host: github.com
579
+ default_forge_host: gh.sample.com
471
580
  ```
472
581
 
473
582
  ## FAQ
data/bin/sj CHANGED
@@ -5,6 +5,7 @@ require 'optparse'
5
5
  require 'mixlib/shellout'
6
6
  require_relative '../lib/sugarjar/commands'
7
7
  require_relative '../lib/sugarjar/config'
8
+ require_relative '../lib/sugarjar/help'
8
9
  require_relative '../lib/sugarjar/log'
9
10
  require_relative '../lib/sugarjar/util'
10
11
  require_relative '../lib/sugarjar/version'
@@ -23,6 +24,7 @@ if ENV['SUGARJAR_LOGLEVEL']
23
24
  options['log_level'] = SugarJar::Log.level = ENV['SUGARJAR_LOGLEVEL'].to_sym
24
25
  end
25
26
 
27
+ options['_cli_overrides'] = {}
26
28
  parser = OptionParser.new do |opts|
27
29
  opts.banner = 'Usage: sj <command> [<args>] [<options>]'
28
30
 
@@ -31,39 +33,39 @@ parser = OptionParser.new do |opts|
31
33
  opts.separator ''
32
34
  opts.separator 'OPTIONS:'
33
35
 
34
- opts.on('--feature-prefix', 'Prefix to use for feature branches') do |prefix|
35
- options['feature_prefix'] = prefix
36
- end
37
-
38
36
  opts.on(
39
- '--forge-host HOST',
40
- '--github-host HOST',
41
- 'The host of your forge (github, gitlab, etc.). Generally only needed' +
42
- ' when cloning (smartclone), as we can usually figure out from within' +
43
- ' a cloned repo. Currently accepts --github-host for backwards' +
44
- ' compatibility.',
37
+ '--default-forge-host HOST',
38
+ 'The default host of your forge (github, gitlab, etc.) when it cannot ' +
39
+ 'be determined automatically. In nearly every case SJ will ' +
40
+ 'automatically determine this. However, for `smartclone`, if ' +
41
+ 'you use shortnames (e.g. org/repo) that do not contain a host, this ' +
42
+ 'is the default to assume. Most useful in your config file when set ' +
43
+ 'to your most comomn forge host (e.g. github.com)',
45
44
  ) do |host|
46
- options['forge_host'] = host
45
+ options['default_forge_host'] = host
47
46
  end
48
47
 
49
- opts.on('--forge-type TYPE', 'Forge type: github, gitlab') do |type|
50
- options['forge_type'] = type
48
+ opts.on(
49
+ '--feature-prefix PREFIX',
50
+ 'Bypass the config and just use PREFIX.',
51
+ ) do |prefix|
52
+ options['_cli_overrides']['feature_prefix'] = prefix
51
53
  end
52
54
 
53
55
  opts.on(
54
- '--github-user USER',
55
- 'User for github repos, unless specified in the repoconfig.' +
56
- ' Defaults to your local username',
57
- ) do |user|
58
- options['github_user'] = user
56
+ '--forge-type TYPE',
57
+ 'GENERALLY NOT NEEDED. In case SJ cannot detect the type of a forge ' +
58
+ 'from the hostname during smartclone. Only available in CLI, not a ' +
59
+ 'config file option. Forge type: github, gitlab.',
60
+ ) do |type|
61
+ options['_cli_overrides']['forge_type'] = type
59
62
  end
60
63
 
61
64
  opts.on(
62
- '--gitlab-user USER',
63
- 'User for gitlab repos, unless specified in the repoconfig.' +
64
- ' Defaults to your local username',
65
+ '--forge-user USER',
66
+ 'Bypass the config and just use USER as the forge user.',
65
67
  ) do |user|
66
- options['gitlab_user'] = user
68
+ options['_cli_overrides']['user'] = user
67
69
  end
68
70
 
69
71
  opts.on('-h', '--help', 'Print this help message') do
@@ -103,6 +105,14 @@ parser = OptionParser.new do |opts|
103
105
  options['pr_autofill'] = autofill
104
106
  end
105
107
 
108
+ opts.on(
109
+ '--fork-name NAME',
110
+ 'When forking a repo (in `smartclone`), fork the repo to a different ' +
111
+ 'name. See the help for `smartclone` below.',
112
+ ) do |val|
113
+ options['fork_name'] = val
114
+ end
115
+
106
116
  opts.on(
107
117
  '--[no-]pr-autostack',
108
118
  'When creating a PR, if this is a subfeature, should we make it a ' +
@@ -122,161 +132,11 @@ parser = OptionParser.new do |opts|
122
132
  exit
123
133
  end
124
134
 
125
- # rubocop:disable Layout/HeredocIndentation
126
- opts.separator <<COMMANDTEXT
127
-
128
- COMMANDS:
129
- amend
130
- Amend the current commit. Alias for "git commit --amend".
131
- Accepts other arguments such as "-a" or files.
132
-
133
- amendq, qamend
134
- Same as "amend" but without changing the message. Alias for
135
- "git commit --amend --no-edit".
136
-
137
- binfo
138
- Verbose information about the current branch.
139
-
140
- br
141
- Verbose branch list. An alias for "git branch -v".
142
-
143
- debuginfo
144
- Prints out a bunch of version and config information useful for
145
- including in bug reports.
146
-
147
- feature, f <branch_name>
148
- Create a "feature" branch. It's morally equivalent to
149
- "git checkout -b" except it defaults to creating it based on
150
- some form of 'master' instead of your current branch. In order
151
- of preference it will be upstream/master, origin/master, master,
152
- depending upon what remotes are available.
153
-
154
- Note that you can specify "--feature-prefix" (or add
155
- "feature_prefix" to your config) to have all features created
156
- with a prefix. This is useful for branch-based workflows where
157
- developers are expected to create branches names that, for
158
- example, start with their username.
159
-
160
- forcepush, fpush
161
- The same as "smartpush", but uses "--force-with-lease". This is
162
- a "safer" way of doing force-pushes and is the recommended way
163
- to push after rebasing or amending. Never do this to shared
164
- branches. Very convenient for keeping the branch behind a pull-
165
- request clean.
166
-
167
- forcesync, fsync
168
- See 'sync' below, but never tries to rebase, always does a
169
- hard reset.
170
-
171
- globalbranchclean, gbclean [<branch>] [<remote>]
172
- WARNING: EXPERIMENTAL COMMAND.
173
-
174
- Combination of "lbclean" and "rbclean". Cleans up
175
- both local and remote branches safely. See those commands for
176
- details.
177
-
178
- globalbranchcleanall, gbcleanall [<remote>]
179
- WARNING: EXPERIMENTAL COMMAND.
180
-
181
- Safely clean all branches, both local and remote. See "gbclean"
182
- for details.
183
-
184
- lint
185
- Run any linters configured in .sugarjar.yaml.
186
-
187
- localbranchclean, lbclean [<branch>]
188
- If safe, delete the current branch (or the specified branch).
189
- Unlike "git branch -d", lbclean can handle squash-merged branches.
190
- Think of it as a smarter "git branch -d".
191
-
192
- Aliased to 'bclean' for backwards compatibility.
193
-
194
- localbranchcleanall, lbcleanall
195
- Walk all branches, and try to delete them if it's safe. See
196
- "lbclean" for details.
197
-
198
- Aliased to 'bcleanall' for backwards compatibility.
199
-
200
- pullsuggestions, ps
201
- Pull any suggestions *that have been committed* in the GitHub UI.
202
- This will show the diff and prompt for confirmation before
203
- merging. Note that a fast-forward merge will be used.
204
-
205
- remotebranchclean, rbclean [<branch>] [<remote>]
206
- WARNING: EXPERIMENTAL COMMAND.
207
-
208
- Similar to lbclean, except safely cleans up remote branches.
209
- Unlike many git commands, <remote> comes after <branch> so
210
- that you can specify a branch and the remote defaults to 'origin'.
211
- This means you can do "sj rclean" to clean the remote branch with
212
- the same name as the local one. Note that you probably want
213
- "sclean", which will do both local and remote cleaning in one
214
- command.
215
-
216
- WARNING: This command cannot differentiate release branches
217
- that are fully merged but still need to be kept around for future
218
- work. So if main contains everything that 2.0-devel and 3.0-devel
219
- has, then those branches will be deleted. Use with caution.
220
-
221
- remotebranchcleanall, rbcleanall [<remote>]
222
- WARNING: EXPERIMENTAL COMMAND.
223
-
224
- Walk all remote branches, and try to delete them if it's safe. See
225
- "rbclean" for details.
226
-
227
- smartclone, sclone
228
- A smart wrapper to "git clone" that handles forking and managing
229
- remotes for you.
230
- It will clone a git repository using hub-style short name
231
- ("$org/$repo"). If the org of the repository is not the same
232
- as your github-user then it will fork the repo for you to
233
- your account (if not already done) and then setup your remotes
234
- so that "origin" is your fork and "upstream" is the upstream.
235
-
236
- smartlog, sl
237
- Inspired by Facebook's "sl" extension to Mercurial, this command
238
- will show you a tree of all your local branches relative to your
239
- upstream.
240
-
241
- smartpullrequest, smartpr, spr
242
- A smart wrapper to "hub pull-request" that checks if your repo
243
- is dirty before creating the pull request.
244
-
245
- smartpush, spush
246
- A smart wrapper to "git push" that runs whatever is defined in
247
- "on_push" in .sugarjar.yml, and only pushes if they succeed.
248
-
249
- subfeature, sf <feature>
250
- An alias for 'sj feature <feature> <current_branch>'
251
-
252
- sync
253
- Similar to `up`, except instead of rebasing on a tracked branch
254
- (usually `upstream` remote), rebases to wherever our remote push
255
- target is (usually `origin` remote). Useful for syncing work
256
- across different machines.
257
-
258
- For example, if you do some work on feature `foo` on machine1 and
259
- push to `origin/foo` (intending to eventually merge to
260
- `upstream/main`), then on machine2, you pull that branch, do more
261
- work, which you also push to `origin/foo`, then on machine1, you
262
- can do `sj sync` to pull down the changes from `origin/foo`. If
263
- you have local changes, that are not already on `origin/foo`,
264
- those will be rebased on top of the changes from `origin/foo`.
265
-
266
- unit
267
- Run any unitests configured in .sugarjar.yaml.
268
-
269
- up [<branch>]
270
- Rebase the current branch (or specified branch) intelligently.
271
- In most causes this will check for a main (or master) branch on
272
- upstream, then origin. If a branch explicitly tracks something
273
- else, then that will be used, instead.
274
-
275
- upall
276
- Same as "up", but for all branches.
277
- COMMANDTEXT
278
-
279
- # rubocop:enable Layout/HeredocIndentation
135
+ opts.separator ''
136
+ opts.separator 'COMMANDS:'
137
+ opts.separator SugarJar::Help.summary_list
138
+ opts.separator ''
139
+ opts.separator "Run 'sj help <command>' for details on a specific command."
280
140
  end
281
141
 
282
142
  extra_opts = []
@@ -328,7 +188,18 @@ SugarJar::Log.debug("Final config: #{options}")
328
188
 
329
189
  # if the command is help, we don't bother to create the Commands obj
330
190
  if subcommand == 'help'
331
- puts parser
191
+ help_target = argv_copy.reject { |x| x.start_with?('-') }[1]
192
+ if help_target
193
+ help_text = SugarJar::Help.command_help(help_target)
194
+ if help_text
195
+ puts help_text
196
+ else
197
+ SugarJar::Log.fatal("No such subcommand: #{help_target}")
198
+ exit 1
199
+ end
200
+ else
201
+ puts parser
202
+ end
332
203
  exit
333
204
  end
334
205
 
@@ -23,8 +23,14 @@ pr_autostack: true
23
23
  # list
24
24
  ignore_deprecated_options: [ 'gh_cli' ]
25
25
 
26
- # User to use when cloning new github repos
27
- github_user: c00ldude
28
-
29
- # User to use when cloning new gitlab repos
30
- gitlab_user: c00ldude
26
+ host_configs:
27
+ default:
28
+ use_forks: true
29
+ github.com:
30
+ user: c00ldude
31
+ gitlab.com:
32
+ user: thisc00ldude
33
+ gitlab.company.com:
34
+ user: tsmith
35
+ use_forks: false
36
+ feature_prefix: "tsmith/"